TeamCity Build – Excluding Projects From a Solution (sln) file.

As part of a solution I was including the 3rd Party “MVCForum” projects which I didn’t want to build on every commit.  I need to exclude this projects from building in TeamCity.  Steps below…

1. Introduce a new solution configuration


Easiest way to do this is through Visual Studio …Build…Configuration Manager….New (I called mine “TeamCity”). Untick the projects you don’t want to include as part of the build. Ensure “Mixed Platforms” is also selected if that’s your intent.

2. Set up an system parameter


In TeamCity, (Build Configuration….Parameters….System Properties…) and add system.Configuration
with Value of the solution config introduced in point 1 (mine being TeamCity).


Don’t do what I first did and specify /p:Configuration=”MyConfig” in the Build Step as TeamCity whines about using a system param.
There are no “Command Line Parameters” required here. That box should be blank. The beauty of setting up a System Parameter means it will be injected automatically by TeamCity at build time.

3. Change build folders


Finally, if you have a Unit Test step(s) and you should have! then you’ll need to change the bin folder of your unit test assemblies to include your Build config name.

2 Comments on “TeamCity Build – Excluding Projects From a Solution (sln) file.

Leave a Reply

%d bloggers like this: