runtime: build failure: error NETSDK1004: Assets file '...' not found. Run a NuGet package restore to generate this file.

When I build this repo using:

$ ./build.sh clr+libs -rc Release /p:NoPgoOptimize=true

My build fails with:

/usr/lib64/dotnet/sdk/5.0.100/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.FrameworkReferenceResolution.targets(324,5): error NETSDK1127: The targeting pack Microsoft.NETCore.App is not installed. Please restore and try again. [/home/tmds/repos/runtime/src/libraries/System.Security.Principal.Windows/ref/System.Security.Principal.Windows.csproj]
/usr/lib64/dotnet/sdk/5.0.100/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.FrameworkReferenceResolution.targets(324,5): error NETSDK1127: The targeting pack Microsoft.NETCore.App is not installed. Please restore and try again. [/home/tmds/repos/runtime/src/libraries/System.Security.Cryptography.Cng/ref/System.Security.Cryptography.Cng.csproj]
/usr/lib64/dotnet/sdk/5.0.100/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.FrameworkReferenceResolution.targets(324,5): error NETSDK1127: The targeting pack Microsoft.NETCore.App is not installed. Please restore and try again. [/home/tmds/repos/runtime/src/libraries/System.Security.Cryptography.OpenSsl/ref/System.Security.Cryptography.OpenSsl.csproj]

@ViktorHofer do you have an idea what may be causing this?

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 60 (60 by maintainers)

Most upvoted comments

I created a new user on my system to rule out something in my HOME causes the problem. Also for this user, I get the same errors.

I thought about what still might be specific about my machine, so ran sudo dnf remove 'dotnet*' which removed all .NET versions I had installed from Fedora repos, and now I can build master. 🎉

I have then added back the versions I had installed: sudo dnf install dotnet-sdk-5.0 dotnet-sdk-2.2 dotnet-sdk-3.1 . And ran a new build, and again I get the error NETSDK1004.

So, the issue I have gets caused by the dotnet packages that are installed on my system.

@ViktorHofer can we change the build script so it prefers dotnet that gets fetched as part of the build, over the one that is installed on the system?

cc @omajid

@nkolev92 would you mind filing a bug to add better logging to RestoreTaskEx?