Exclude projects from solution during build in MSBuild on a CI server - visual-studio

I am working on a solution in Visual Studio that contains a number of projects:
Solution.sln:
-> ProjectInc1.csproj
-> ProjectInc2.csproj
-> ProjectExc1.csproj
-> ProjectExc1.csproj
I work on all projects and when I make a push on my VCS (Github in my case) it triggers a build configuration on a CI server (TeamCity in my case). TeamCity server uses MSBuild, that takes the Solution.sln as parameter and builds it. However I want certain projects (e.g. ProjectExc1.csproj, ProjectExc2.csproj) to be ignored from build. I can do this step if I remove the project references from Solution.sln file, but I think there must be a better way to exclude from build certain project.
Does anyone know how to configure MSBuild or the Solution itself to ignore these projects when building the solution on the CI Server?

In Visual Studio create a new build configuration (from http://msdn.microsoft.com/en-us/library/jj676765.aspx):
To create a solution configuration that excludes a project
On the menu bar, choose Build, Configuration Manager.
In the Active solution configuration list, choose .
In the Name box, enter a name for the solution configuration.
In the Copy settings from list, choose the solution configuration on which you want to base the new configuration (for example, Debug),
and then choose the OK button.
In the Configuration Manager dialog box, clear the check box in the Build column for the project that you want to exclude, and then
choose the Close button.
On the Standard toolbar, verify that the new solution configuration is the active configuration in the Solution
Configurations box.
On the menu bar, choose Build, Rebuild Solution.
Then in TeamCity, instead of building in Debug/Release set the configuration to build with your new build configuration name.
If you are calling from an MsBuild script, the same applies. Just change the configuration you are calling.

Related

TeamCity continues to build projects that have been excluded from my Visual Studio solution configuration

My Visual Studio 2019 solution contains several projects, some of which I don't want to be built as part of continuous integration. Specifically, I'm trying to exclude tooling and unit tests.
In Visual Studio, I have created a new solution configuration and unchecked the "Build" box for each project I don't want to be built.
In TeamCity, I have specified the name of the new solution configuration to use. However, TeamCity continues to attempt to build all projects within the solution.
[I had included screenshots of my solution configuration, TeamCity build configuration, and resulting TeamCity log but I do not have enough reputation to post images apparently.]
From everything I could find so far, unchecking "Build" from the solution configuration used by TeamCity is supposed to exclude that project from building.
I figured it out by finally noticing that the TeamCity log was showing the build configuration as "ReleaseCI|Mixed Platforms" instead of "ReleaseCI|Any CPU". On other projects, I only needed to specify the configuration. For this project, I apparently have to specify the platform as well.

visual studio 2017 custom configurations

I have a solution with several custom configurations (staging, QA, etc)
Ive added a new project (azure webjob) but the newly added project cant see the custom configurations only the standard Debug & Release.
In the configuration manager the only options I have alongside my new project are debug & release its not seeing the other custom configs.
Is there a workaround for this ?
Each project and solution has its own list of configurations. The Configuration Manager defines which project configurations will be used for a given solution configuration. So if you add a new project to a solution that already has custom configurations, the project will still only have the default configurations for its type (Debug and Release in this case).
To create new project configurations and associate them with solution configurations of the same name:
Right-click your solution in Solution Explorer and open the Configuration Manager.
Select your custom solution configuration in Active solution configuration.
In the Project contexts list, find your newly-created project.
Expand the Configuration drop down and select New....
Type the Name of the solution configuration.
Select Copy settings from whichever project configuration makes sense.
Click OK.

exclude assembly from build

I have a solution file with 10 assemblies. When I build the solution I would like to exclude 5 of them from being built and put in the Release folder. I tried going into the properties of the solution and unticking the assemblies in the Build column in the configuration properties, but this did not work.
If may use Configuration Manager tool of visual studio by write clicking on your solution in VS and selecting Configuration Manager and in active solution configuration combo box selection New
deselecting any project.
More configuration options for this newly created build will be possible by right clicking on each project any selecting properties part and going to Build tab(like output path will be editable)

How to customize fortify visual studio plugin

I am very new to HP Fortify SCA tool. I have Fortify plugin for Visual Studio 2010 installed. Now if I start analyzing the code, it includes all project in that solution. But I have lot of test projects which I want to exclude from analysis. If anyone has any idea how to customize the list of projects which need to be included for analysis.
You can exclude the projects from scanning by setting them not to build from the solution configuration.
For example, one way to accomplish this is:
Build -> clean solution
Highlight solution, right click and select Properties
Select configuration properties (ensure configuration is set to debug)
uncheck the build column of each project you do not wish to scan
Now when you scan in debug mode, you will not be translating/scanning the projects that are not set to build in that configuration.
Hope this helps.

In Visual Studio 2010, how do I stop new projects being added & built in every existing build configuration

I have a number of configurations setup in Visual Studio with a carefully crafted list of projects that each one should build.
When I create a new project in the solution it gets selected for building automatically in every existing build configuration.
Is there an option to stop this occurring?
In the solution configuration manager you can unselect build (and deploy) of individual projects for different build configurations.
Right click on solution, select properties, Configuration Properties.
Or Build | Configuration Manager

Resources