5
votes

We use automatic deployment process in Azure by KUDU scripts and by today we see strange error in Azure deployment center:

Command dotnet publish (and also 'dotnet build') returns:

MSBUILD : error MSB1025: An internal failure occurred while running MSBuild.
Unhandled exception. System.ComponentModel.Win32Exception (5): Access is denied.
System.ComponentModel.Win32Exception (5): Access is denied.
   at System.Diagnostics.Process.set_PriorityClassCore(ProcessPriorityClass value)
   at System.Diagnostics.Process.set_PriorityClass(ProcessPriorityClass value)
   at Microsoft.Build.CommandLine.MSBuildApp.Execute(String[] commandLine)
   at Microsoft.Build.CommandLine.MSBuildApp.Main(String[] args)
   at System.Diagnostics.Process.set_PriorityClassCore(ProcessPriorityClass value)
   at System.Diagnostics.Process.set_PriorityClass(ProcessPriorityClass value)
   at Microsoft.Build.CommandLine.MSBuildApp.Execute(String[] commandLine)
Failed exitCode=-532462766, command=dotnet publish "D:\home\site\repository\
...

Details:

  • there is automatic deployment process by KUDU script
  • app is .NET Core application, .csproj has target framework: netcoreapp2.2

Issue probably will be on Azure side, because we did't do any bigger change in the project. Has anybody same/similar issue?

2
Thanks for your input here, I stuck at same situation do you get any proper documentation for this issue, if yes please help us to come out of this situation.Deepak Patel

2 Answers

7
votes

We had the same issue and after investigation we found that:

  • Azure applied new 'dotnet' version 3.1.301 and this version of SDK throws that error (your version you can check by commnad 'dotnet --version')
  • by command 'dotnet --list-sdks' you can see all installed SDKs
  • then we simple used previous version (in our case v3.1.202)
  • the easiest way how to tell exact version of dotnet sdk is by global.json

Example: global.json

{
  "sdk": {
    "version": "3.1.202"
  }
}

And file must be in 'working directory', and KUDU script has working directory here D:\home\site\repository

When your deployment was OK on previous version of dotnet SDK, than this should definitely help.

0
votes

This problem could also happen in other situations because of the sdk is installed as admin (e.g if installed with sudo). In this case uninstalling the sdk and installing it as non-admin user could help resolve the issue. You can use this script to install for non-admin user.

e.g (tested on ubuntu 20.04):

$ wget https://dot.net/v1/dotnet-install.sh
$ chmod +x dotnet-install.sh
$ ./dotnet-install.sh -c Current

Add to the path and verify:

$ echo "export PATH=$HOME/.dotnet:$PATH" >> ~/.bashrc
$ exec bash
$ dotnet --version
3.1.402

NB: After doing this you may get an error error : Unable to obtain lock file access on '/tmp/NuGetScratch/lock then you could remove it and good to go.

sudo rm -r /tmp/NuGet*