1
votes

Experiencing, MSBUILD.exe is taking very long time.

This command is taking 50+ min to execute: C:\Program Files (x86)\MSBuild\14.0\Bin\amd64>MSBUILD C:\xyz.sln /p:Configuration=Release /p:OutDir=c:/test

This command is taking 1 min to execute: C:\Program Files (x86)\MSBuild\14.0\Bin\amd64>MSBUILD C:\xyz.sln /p:Config=Release /p:OutDir=c:/test

Question:

1: Is that ok to use /p:Config=Release instead of /p:Configuration=Release?

2: What can be the root cause to making the build so long with /p:Configuration=Release?

1
/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
@am28, Any update for this issue? Have you understand the reason for this issue? If not, would you please let me know the latest information about this issue?Leo Liu-MSFT
@LeoLiu-MSFT Thanks for the response and following on this. defiantly, your response helped to know, where should i look into. and did flow that /v:diag command and got the logs, in log found while building its trying to clean every dll (_CleanUnfilteredPriorFileWrites=) which are generated till now its in kind of loop. which is nothing related to current build. still trying to get the bottom of this.am28
found the root cause, its was because of obj/Release/{project}.csprojResolveAssemblyReference.cache file having reference for all the build released so far. and due that in every new build process it was accessing those all old builds and cleaning configuration.so all the time was going here. when i cleaned this Release folder, and run the MSBuild, got the response in expected time. Thanks for the guidance.am28

1 Answers

2
votes

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:

enter image description here

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

enter image description here