2009-10-07 109 views

回答

1

這只是一個文本文件。在文本編輯器中打開它並查看。你正在尋找所有的項目指令。編寫一個簡單的解析器來提取* .vcproj名字應該不難。

2

這個數組將會給你完整的解決方案的細節用在解決方案中創建項目...

public List<string> getAllProjectNames(string path) 
    { 
     string[] arr = System.IO.File.ReadAllLines(path); 
     List<string> projects = new List<string>(); 
     for (int i = 0; i < arr.Length; i++) 
     { 
      if (arr[i].StartsWith("Project")) 
      { 
       string [] temp = arr[i].Split(','); 
       projects.Add(temp[1]); 
      } 
     } 
     return projects; 
    } 

調用此方法像...

List<string> Arr = getAllProjectNames(@"D:\Projects\PersonalRD\SearchingList\SearchingList.sln"); 

後,嘗試搜索所有項目名稱字符串項目以項目開頭...

相關問題