2

In my project solution has multiple projects and I want to rebuild it using msbuild engine but excluding only one project only for that time because I want to build that particular project separately in another method. that's the reason I guess, I can't write Exclude property in

Here is my command -

msbuild Demo.sln /t:Rebuild /p:Configuration=Release /p:BuildProjectReferences=false

Is there any way to exclude a project from build at command line?

Manashri
  • 21
  • 2
  • This is not a duplicate question. please have a look at my ques again I just edit it and also I don't want to change build configuration because its a "SingleImage" and rest of the project in that same solution is "Release" – Manashri Feb 23 '18 at 16:11
  • Can't you create a new build configuration for msbuild, as per the linked answer? "You can exclude projects at the solution level for a specific build configuration by using the Configuration Manager Dialog in Visual Studio" – Stephen Kennedy Feb 23 '18 at 17:19
  • If you don't want to create a custom configuration in the Configuration Manager Dialog, there are a couple of alternatives 1) run the MSBuild command for each `.csproj` file you want to build instead of the `.sln` file 2) Create a separate `.sln` file for this purpose – NightOwl888 Feb 23 '18 at 18:02
  • @NightOwl888 I liked your both options but it is building dynamically in my case. I will build many solution with this command and every solution has different number of projects so that's the reason I can't build for each project separately and Separate `.sln` is not possible for this kind of situation. I know this is very weird situation. – Manashri Feb 23 '18 at 19:10
  • Then use the Configuration Manager Dialog and add a new configuration. This edits the `.sln` file with an additional project configuration. You will also need to go through each `.csproj` to add the appropriate XML conditions and setup accordingly (or at least check them). Once you have a new configuration setup (such as `Release2`) then you can pass `/p:Configuration=Release2` as a parameter and it will compile the solution with your excluded projects. – NightOwl888 Feb 23 '18 at 19:16
  • @StephenKennedy, My exclude project 's configuration is Single Image and I mentioned `Release` in command. so, it should not be include in that build process. that's I don't understand. When I build my solution using above command, Unwanted project is also getting build successfully but that I don't want to build because it consumes too much time and I don't wanna waste my time on that unwanted project. – Manashri Feb 23 '18 at 19:28

0 Answers0