1

I am running the build command like this:

set MSBuildParams=/m:16 /target:Rebuild /property:Configuration=""Release"";Platform=""x64"" msbuild %MSBuildParams% C:\path\to\the\sln\Solution.sln

I'm using the following msbuild version: Microsoft (R) Build Engine version 14.0.25420.1

Solution.sln contains 2 projects,

  • let's say Project1 and Project2.
  • Project1 is set as the startup project.
  • After I build the Solution.sln using this setup, I would like to rebuild it, but this time using Project2 as the startup project.

Is there a way to do that, without changing the Solution.sln? What would be the best practice to accomplish that?

Anuj.T
  • 1,598
  • 16
  • 31

1 Answers1

1

You could use the specific command line to build/rebuild the specific project using MSbuild like the following case.

specify project file of a solution using msbuild

But we have to change certain files if you want to change the start up project without using the VS IDE, since the setting was stored into the ".SUO" file.

Actually there is no setting in ".SLN" file for startup project even if you don't want to change it,

In addition, the start up project was the running project of the solution, maybe you don't have to change it:

https://social.msdn.microsoft.com/Forums/windowsdesktop/en-US/b6347dce-8449-4cbb-a606-7b19407a1026/how-do-i-set-the-startup-project-in-the-sln-file?forum=vcgeneral

Leo Liu
  • 71,098
  • 10
  • 114
  • 135