specify project file of a solution using msbuild

前端 未结 5 618
误落风尘
误落风尘 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:48

    msbuild test.sln /t:project /p:Configuration="Release" /p:Platform="x86" /p:BuildProjectReferences=false
    

    Notice that what is assigned to /t is the project name in the solution, it can be different from the project file name.

    Also, as stated in How to: Build specific targets in solutions by using MSBuild.exe:

    If the project name contains any of the characters %, $, @, ;, ., (, ), or ', replace them with an _ in the specified target name.

    You can also build multiple projects at once:

    msbuild test.sln /t:project;project2 /p:Configuration="Release" /p:Platform="x86" /p:BuildProjectReferences=false
    

    To rebuild or clean, change /t:project to /t:project:clean or /t:project:rebuild

提交回复
热议问题