![](/img/trans.png)
[英]TFS 2015 - TF401002: The SQL Server Database Engine failed to save the database backup to path
[英]TFS2015: Full File Path Stored in SQL Database
我正在查看TFS2015(或TFS的任何版本,在這種情況下為2015或2010)背后的SQL數據庫是否存儲文件的完整文件路徑。 我們在Project文件夾中包含了一些信息(即版本號),盡管我意識到有更好的方法來跟蹤此信息,但我們有很多舊數據,只在該路徑中存儲了版本。 我想將數據提取到Crystal Reports中以剝離信息,然后使用它。
您想在TFS源代碼管理中獲取文件夾列表,而不是在數據庫中查詢,我們建議以編程方式實現。 下面的博客以及與之相關的示例代碼將滿足您的需求:
另外,在這種情況下 ,請檢查代碼片段,這應該對您有幫助:
ICommonStructureService structureService = (ICommonStructureService)Tfscollection.GetService(typeof(ICommonStructureService));
ProjectInfo[] projects = structureService.ListAllProjects();
//combo_projects.ItemsSource = projects;
////Create VersionControlServer object from TFS
//sourceControl = (VersionControlServer)tfs.GetService(typeof(VersionControlServer));
RecursionType recursion = RecursionType.OneLevel;
Item[] items = null;
string path = "$/" + projects[0].Name;//"$/TescoPOC/FetchStoryfromTFS";
ItemSet itemSet = versionControl.GetItems(path, recursion);
items = itemSet.Items;
//Dictionary<string, int> FolderListName = new Dictionary<string, int>();
List<string> FolderListName = new List<string>();
foreach (Item keyItem in items)
{
char[] charSeparators = new char[] { '/' };
//Using split to isolated the Project Name and the File Name
string[] ss = keyItem.ServerItem.Split(charSeparators, StringSplitOptions.None);
if (keyItem != items[0])
{
string filename = keyItem.ServerItem.Replace(path + "/", string.Empty);
if (filename != "BuildProcessTemplates")
{
FolderListName.Add(filename);
//if (FolderListName.ContainsKey(filename))
// FolderListName[filename] = FolderListName[filename] + 1;
//else
// FolderListName.Add(filename, 1);
}
}
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.