受欢迎的博客标签

Package DnsClient, version 1.2.0 was not found on Ubuntu 18.04

Published

error NETSDK1064: Package DnsClient, 1.2.0 was not found.

usr/share/dotnet/sdk/3.1.201/Sdks/Microsoft.NET.Sdk/targets/Microsoft.PackageDependencyResolution.targets(234,5): error NETSDK1064: Package DnsClient, version 1.2.0 was not found. It might have been deleted since NuGet restore. Otherwise, NuGet restore might have only partially completed, which might have been due to maximum path length restrictions. [/app/myApp.csproj]
The command '/bin/sh -c dotnet publish -c Release -o out' returned a non-zero code: 1

 

os:Ubuntu 18.04

version:.net 5.0

 

When solutions like using --no-cache are not restoring at all work, it usually indicates that artifact from the host machine are getting copied into the build container. This can cause problems when the host machine and build container have different RIDs. This can commonly occur on Windows machines when running linux containers.

 

dotnet clean

dotnet restore

 

dotnet run

ok

For me it helped adding a --no-cache flag

RUN

 dotnet publish -c Release -o out --no-cache
or
 dotnet publish -c Release  --no-cache
 dotnet publish -c release  --no-cache