.net 5 dotnet build hangs on restore on Linux CentOS/Redhat

1.2k Views Asked by At

dotnet build hangs on restore after installing the .net 5 sdk on the machine. When I cancel it shows the following:

MSBUILD : error MSB4166: Child node "3" exited prematurely. Shutting down. Diagnostic information may be found in files in "/tmp/" and will be named MSBuild_*.failure.txt. This location can be changed by setting the MSBUILDDEBUGPATH environment variable to a different directory.
MSBUILD : error MSB4166: Child node "4" exited prematurely. Shutting down. Diagnostic information may be found in files in "/tmp/" and will be named MSBuild_*.failure.txt. This location can be changed by setting the MSBUILDDEBUGPATH environment variable to a different directory.
MSBUILD : error MSB4166: Child node "2" exited prematurely. Shutting down. Diagnostic information may be found in files in "/tmp/" and will be named MSBuild_*.failure.txt. This location can be changed by setting the MSBUILDDEBUGPATH environment variable to a different directory.
/usr/share/dotnet/sdk/5.0.201/NuGet.targets(131,5): error : Restore canceled! [/srv/project/project.csproj]

The nuget config is setup to with a proxy in ~/.nuget/NuGet/NuGet.Config

<?xml version="1.0" encoding="utf-8"?>
<configuration>
<config>
  <add key="dependencyVersion" value="Highest" />
  <add key="http_proxy" value="http://proxy.url.com:8080" />
</config>
  <packageSources>
    <add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
  </packageSources>
</configuration>

I'm not sure what changed, and as far as I know nothing has changed with the proxy url. This previously worked with .net core 3.1, but no longer works when the new sdk was installed.

Is there something that changed that I need to address? I'm not seeing anything about this in the .net 5 change log. At least from my search for anything nuget.

1

There are 1 best solutions below

0
On BEST ANSWER

I had to completely reinstall .net5. The previous installation hung on the restore because it's behind a proxy. And for some reason the new sdk wasn't acknowledging the proxy setting, or the install was getting hung somewhere in that process.

It's a redhat distro, so yum list installed | grep "dotnet" and used that to remove everything. I deleted the .nuget package and I manually installed using the dotnet-install.sh provided by Microsoft: ./dotnet-install.sh -c 5.0. I had to go through a few more hoops since it was a manual install and it defaulted to ~/.dotnet as the installation directory, but after getting the executable in the path, and assigning the correct environment variables in the service, I was able to get it compiled onto the server again and it's running.