2010-06-25 65 views
0

我正在嘗試爲Visual Studio 2008創建一個插件,該插件將列出所有未從當前構建配置中排除的文件。Visual Studio Addin「從構建中排除」屬性

我目前有測試C++控制檯應用程序有10個文件,其中2個是「從構建中排除」。這是一個屬性,它允許從特定配置中排除特定文件(即調試或發佈)。此屬性位於解決方案資源管理器中右鍵單擊某個文件並選擇Properties-> Configuration Properties-> General-> Excluded From Build

此刻,我有以下代碼將循環所有項目文件和獲取每個文件的屬性。

foreach (Project theProject in _applicationObject.Solution.Projects) 
    { 
     getFiles(theProject.ProjectItems); 
    } 

private void getFiles(ProjectItems theItems) 
{ 
    foreach (ProjectItem theItem in theItems) 
    { 
     string theItemName = theItem.Name; 
     foreach (Property theProp in theItem.Properties) 
     { 
      string thePropName = theProp.Name; 
     } 
     getFiles(theItem.ProjectItems); 
    } 
} 

我遇到的問題是我似乎無法找到「Excluded From Build」屬性。我無法找到哪些屬性列在哪裏的非常好的文檔。這個Excluded From Build屬性位於_applicationObject對象內的什麼位置?

回答

0

我不熟悉的Visual Studio的對象模型,但VS2005的文檔中的下列對象有一個ExcludedFromBuild屬性:

VCFileConfiguration
VCFileConfigurationProperties
VCPreBuildEventTool
VCPreLinkEventTool
VCPostBuildEventTool
VCWebDeploymentTool

希望這會引導你走向正確的道路。