1: Is that ok to use /p:Config=Release instead of /p:Configuration=Release?
I am afraid is not. Just as Lex comment, /p:Config=Release
is not a valid argument. I have create a test sample with that argument, but I found that solution is build with default configuration Debug
:
So the argument /p:Config=Release
is a invalid.
What can be the root cause to making the build so long with /p:Configuration=Release?
As test above, when you build with /p:Config=Release
, VS/MSBuild will build solution with default configuration Debug
. As we know, Debug mode does a lot less optimizations, as those can mess up the mapping between instructions and lines of code. So, the compiler is doing less work there.
Even if a full debug build is slower, Debug builds happen a lot more often and can usually take advantage of incremental builds a lot more than Release build can. So fairly often a Debug build doesn't have to do nearly as much work as a Release build would. So the command with Debug configuration will take less build time.
Besides, when you first completed the build solution, you should clean the solution, otherwise, most of projects in the solution will skip building. Because most of them are up-to-date. So you should clean the solution after you build the solution first time.
In addition, if you want to know the detail info about build process, you can set the "Logging Verbosity" to the value Diagnostic by addding /v:diag
to your build command line:
MSBUILD C:\xyz.sln /p:Configuration=Release /p:OutDir=c:/test /v:diag
/p:Config=Release
is not a valid way. To learn where the slowness comes from, append/v:diag
to your command line and then analyze the output. – Lex Li