Exclude Project from Visual Studio Team Services(VSTS) Build Definition

By | March 14, 2018

You can exclude project from Visual Studio Team Services build definition if required. You might want to exclude a specific project that breaks your build, or you don’t want a specific project to build as part of your release process for some time. You may be facing some build issues due to that project which you want to do root cause analysis later, or you have further plan to exclude the project altogether. Well, you can build a solution without building all projects that it contains in your local development environment or can also push the same for the build definition running at your Visual Studio Team Services.

Exclude project from Visual Studio Team Services build definition

You can exclude any specific project at the solution level for a specific build configuration by using the Configuration Manager Dialog in Visual Studio. Navigate From the main menu, Build -> Configuration Manager

Configuration Manager

Configuration Manager

As you can see from the above picture, we have unchecked the Build option for MyWebUI.Logic project, which means either in Visual Studio or in Build Server, if the configuration is set to “Release” build will exclude the MyWebUI.Logic project.
While, this work, it is always better to keep the release definition intact and create a new configuration definition and do necessary changes to that rather changing existing.

New Configuration

New Configuration

Select the <New> from the “Active Solution Configuration”, provide a name ( in this case we have given CustomBuildConfig) and set the “Copy settings from” to Release.

New Configuration File

New Configuration File

Once the new configuration file is created, then uncheck the build option for the respective project. You can then also notice Visual Studio has a new configuration option.

New Configuration Settings in Visual Studio

New Configuration Settings in Visual Studio

Once this is done, you can test and verify your build in local and post your verification publish the code in your code repository.

Update the Configuration in Team Services Build Definition

Open the Build definition from the Visual Studio Team Services and select the Build Solution Task. You will find configuration is getting read from the BuildConfiguration variable.

Editing Build Configuration in VSTS

Editing Build Configuration in VSTS

Navigate to the Variable Tab and change the values for BuildConfiguration to CustomBuildConfig from Release.

Update the Build Configuration Variable

Update the Build Configuration Variable

That’s it. Your build process will now run with the updated configuration. At any point, if you want to revert your build definition to run in release mode, just update the values of the build configuration variable in the build definition.

You can read following post for more details on build and release management.

Hope this helps.

Leave a Reply