Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

first call to msbuild hangs

I am using a powershell script that internally calls msbuild to build my solutions. This works in principle, so the solution files are ok.

I can repeat the build, it works flawlessly.

But the build hangs

  • the first time I start the script (after reboot)
  • after some time / actions during the work day, no idea what changes

So my suspicion is, that msbuild is using some component that is not loaded when I reboot / that is unloaded during the work.

But I have no clue how to find the problem...

I am using this exe: C:\Program Files (x86)\MSBuild\14.0\bin\MsBuild.exe

Any ideas?

like image 849
klawusel Avatar asked Nov 03 '15 09:11

klawusel


People also ask

How do I start MSBuild?

To run MSBuild at a command prompt, pass a project file to MSBuild.exe, together with the appropriate command-line options. Command-line options let you set properties, execute specific targets, and set other options that control the build process.

Does MSBuild run unit tests?

xUnit.net includes a runner which can be used from your MSBuild scripts to run unit tests. The runner is contained in the NuGet package xunit.

Is MSBuild installed by default?

If you have Visual Studio, then you already have MSBuild installed. With Visual Studio 2022, it's installed under the Visual Studio installation folder. For a typical default installation on Windows 10, MSBuild.exe is under the installation folder in MSBuild\Current\Bin.

What does MSBuild command do?

Builds the targets in the project file that you specify. If you don't specify a project file, MSBuild searches the current working directory for a file name extension that ends in proj and uses that file. You can also specify a Visual Studio solution file for this argument.


1 Answers

For anybody running into this issue: Roslyn does a "shared compilation" by default, which means that results of compiles are used for further compilations to gain speed. You can switch this of by providing "False" for UseSharedCompilation in VBPROJ files or using a similar switch for MsBuild. Switching this off will do slower compiles but the run does not hang.

like image 178
klawusel Avatar answered Sep 27 '22 19:09

klawusel