Visual Studio 插件“从构建中排除”财产
我目前正在尝试为 Visual Studio 2008 创建一个插件,它将列出当前构建配置中未排除的所有文件。
我目前测试的 C++ 控制台应用程序有 10 个文件,其中 2 个是“从构建中排除”的。该属性允许将特定文件从特定配置(即调试或发布)中排除。当您右键单击解决方案资源管理器中的文件并选择“属性”->“配置属性”->“常规”->“从构建中排除”时,即可找到此属性
目前,我有以下代码将循环遍历所有项目文件并获取每个文件的属性。
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);
}
}
我遇到的问题是我似乎找不到“从构建中排除”属性。我找不到关于在哪里列出哪些属性的非常好的文档。此“从构建中排除”属性位于 _applicationObject
对象中的什么位置?
I am currently trying to create an addin for Visual Studio 2008 that will list all files which are not excluded from the current build configuration.
I currently have test C++ console application that has 10 files, 2 of which are "Excluded From Build". This is a property that will allow a specific file to be excluded from a specific configuration (i.e. Debug or Release). This property is located when you right click on a file in the solution explorer and select Properties->Configuration Properties->General->Excluded From Build
At the moment I have the following code that will loop though all project files and get the properties for each file.
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);
}
}
The issue I am having is that I cant seem to find the "Excluded From Build" property. I cannot find very good documentation on what properties are listed where. Where is this Excluded From Build property located within the _applicationObject
object?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不熟悉 Visual Studio 对象模型,但在 VS2005 的文档中,以下对象具有 ExcludedFromBuild 属性:
希望这会引导您走上正确的道路。
I'm not familiar with the Visual Studio object model, but in the documentation for VS2005 the following objects have an ExcludedFromBuild property:
Hopefully this will lead you down the right path.