views:

42

answers:

1

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?

A: 

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.

Luke