9

We have several projects containing XAML UI and XAML workflow files. Since we enabled execution of MSBuild in parallel, with the flag /m the builds, from time to time we get an exception in the MSBuild task XamlMarkupCompilePass1

##[error]C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Xaml.targets(193,5): Error XC1000: XC1020: Build error occurred in the XAML MSBuild task: 'Could not load file or assembly 'file:///C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.7.2\Facades\System.Threading.ThreadPool.dll' or one of its dependencies. Access is denied.

This is just an example, it is also happening sometimes on NuGet packages and not only .NET framework assemblies.

What is our setup: We have build servers and on each we have at least 2 build agents.

What did we try out already:

  1. Turning off build agents to have only one per server, still running MSBuild with /m --> failed with Access denied
  2. Run msbuild without /m --> was successful, but not a solution because of too long running build
  3. Try to use a hidden flag for MSBuild, to retry on access denied MSBUILDALWAYSRETRY --> this is only used for Copy MSBuild task and not the XAML msbuild task

Question: Is there a way to affect the MSBuild task XamlMarkupCompilePass1 somehow? or is there another solution than turning off parallel execution of MSBuild? I guess there is also a possibility that XamlMarkupCompilePass2 could fail as well but didn't see that.

fl0tschi
  • 101
  • 1
  • 6
  • Not a satisfying answer, but there seems to be a history of folks having to resort to disabling parallel builds to avoid this issue. See: https://stackoverflow.com/a/36836940/529618 + https://stackoverflow.com/a/23069603/529618 – Alain Sep 20 '22 at 20:05

0 Answers0