specify project file of a solution using msbuild

前端 未结 5 624
误落风尘
误落风尘 2020-11-27 11:10

I want the commandline for building a particular project of a solution using msbuild like we do with devenv.com.In devenv.com we can specify a project of a solution using fo

5条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-11-27 11:42

    In order to do this, you need to know what the project's target-name is, not necessarily the project name.

    One way to find this out is to use MSBuild against your SLN with intended parameters after setting a special environment variable called MSBuildEmitSolution to the value of 1.

    set MSBuildEmitSolution=1
    msbuild my_stuff.sln /t:rebuild /p:Configuration=Release /p:Platform=x64
    

    I recently had to do this due to a very specific name for a target in nested directories. So from my generated file, my_stuff.sln.metaproj I found this line:

    That means the command-line to use ends up being,

    msbuild my_stuff.sln /t:Utils\Firewall\FirewallUtils:Rebuild /p:Configuration=Release /p:Platform=x64
    

提交回复
热议问题