I have a Web Application which consists of three projects under one solution. But, I want allow only two projects in Build definition to build through arguments in VSTS. Is it possible, If possible how I want to skip one project through command in Arguments?
-
1Perhaps an easier answer is to use your solution configuration, and forget the VSTS arguments. https://stackoverflow.com/questions/9778916/how-to-exclude-project-from-build-in-msbuild – raterus Jan 04 '18 at 15:21
1 Answers
There is no such settings in VSTS that can skip one project from multiple projects in a solution.
If you want to skip a project for VSTS, you should change .sln
correspondingly (as raterus mentioned). Detail steps as below:
Open the solution in VS -> Build -> Configuration Manager -> select the build configuration(s) and build platform(s) which you want to skip to build the project -> deselect the the project you want to skip for build -> Close.
Then save the change for .sln file, and commit and push (checkin) the changes to VSTS repo.
Now you can build in VSTS, it will skip the project you specified in VS.
And you can also the document How to: Exclude Projects from a Build.
If you don't want to remove the project info in .sln
, the work around is change the .sln
before VS Buils task, and recover the .sln
after the task.
Such as if you are using git as VCS, you can use below ways to skip a project to build:
Before VS build task, add a PowerShell task with below script:
git checkout $(BUILD.SOURCEBRANCHNAME) (get-content "$(Build.SourcesDirectory)\relative\path\to\solution") -notmatch "{project_ID}.$(BuildConfiguration)" | out-file "$(Build.SourcesDirectory)\relative\path\to\solution"
Such as:
git checkout $(BUILD.SOURCEBRANCHNAME) (get-content "$(Build.SourcesDirectory)\ConsoleAppCore\ConsoleAppCore.sln") -notmatch "{ECF93D95-5096-497E-B4B8-83416DABB516}.$(BuildConfiguration)" | out-file "$(Build.SourcesDirectory)\ConsoleAppCore\ConsoleAppCore.sln"
After VS Build task, add another PowerShell task to recover the
.sln
with the script:git reset --hard head
Then, in the VS Build task, you will find the project is skip to build.

- 36,876
- 5
- 61
- 74
-
Thanks for your reply, as you said that remove/ Unchecked the related project which I want remove. But what I need is , remove the related project regarding Build Definition in VSTS (the project must be Check-In to VSTS) – Mani Jan 05 '18 at 08:59
-
@Mani I added a work around to skip a project to build in the end of my answer, you can have a try. – Marina Liu Jan 05 '18 at 09:48
-
Right now, Am not using Git for Building purpose instead of that Am using VSTS. So can you please update your answer related to VSTS – Mani Jan 05 '18 at 11:23
-
You can use the similar method, just change the way to undo TFVC repo changes by `tf undo * /recursive` command. – Marina Liu Jan 08 '18 at 09:45
-