Visual Studio 插件“从构建中排除”财产

发布于 2024-09-07 05:43:42 字数 830 浏览 2 评论 0原文

我目前正在尝试为 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

我喜欢麦丽素 2024-09-14 05:43:42

我不熟悉 Visual Studio 对象模型,但在 VS2005 的文档中,以下对象具有 ExcludedFromBuild 属性:

VC 文件配置
VC 文件配置属性
VCPreBuildEventTool
VCPreLinkEventTool
VCPostBuildEventTool
VCWeb部署工具

希望这会引导您走上正确的道路。

I'm not familiar with the Visual Studio object model, but in the documentation for VS2005 the following objects have an ExcludedFromBuild property:

VCFileConfiguration
VCFileConfigurationProperties
VCPreBuildEventTool
VCPreLinkEventTool
VCPostBuildEventTool
VCWebDeploymentTool

Hopefully this will lead you down the right path.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文