sdk icon indicating copy to clipboard operation
sdk copied to clipboard

Can't update packages NU1007 : runtime.json could not be found

Open Gavin-Williams opened this issue 3 years ago • 4 comments

Describe the bug

I can't update the package Microsoft.Windows.SDK.BuildTools from 10.0.22000.197 to 10.0.22621.1.

I get the following output:

NU1007: The runtime.json specified in the project 'C:\Program Files\dotnet\sdk\6.0.301\RuntimeIdentifierGraph.json' could not be found. Package restore failed. Rolling back package changes..

This is probably not reproducible from my end. This is a random issue that I see every now and again from Visual Studio. And I've seen it across many installs. My projects were working. I updated VS. The most recent project in the solution is working, and I can update it's packages. But other projects are broken with many errors and I can't update their packages.

The kinds of errors I see are..

Linq does not exist in the namespace system Text does not exist in the namespace system Predefined System.Object is not defined or imported

Gavin-Williams avatar Jul 13 '22 14:07 Gavin-Williams

I just got the same error but trying to update one of my own packages from an Azure DevOps feed. Just updated VS2022 Enterprise to latest version 17.2.6 running on Windows 11. I have VS 2022 preview installed side-by-side, not sure if that means anything.

Restart VS; clean solution; rebuild all; back to nuGet, then it worked. SMH

richardhauer avatar Jul 14 '22 06:07 richardhauer

I have the same issue, noted that 6.0.301 mentioned in the path no longer exists.

Seems to have been updated to 6.0.302 yesterday.

Likely cause is updating to Visual Studio 2022 17.2.6

imm-olate avatar Jul 14 '22 06:07 imm-olate

@nkolev92 @aortiz-msft Since the error is coming from NuGet, is this something you've seen before? My copy of that .json file doesn't have a reference to a runtime.json file so I wonder if the error message is off.

marcpopMSFT avatar Aug 03 '22 21:08 marcpopMSFT

I've actually never seen this get flagged before. The property that the SDK passes to NuGet is RuntimeIdentifierGraphPath.

My copy of that .json file doesn't have a reference to a runtime.json file so I wonder if the error message is off

Can you elaborate on that? I'm not sure I understand it.

The codepath seems to suggest that it's correct. https://github.com/NuGet/NuGet.Client/blob/421801a875b876882ffe24d87e7ea0862bb1b41f/src/NuGet.Core/NuGet.Commands/RestoreCommand/ProjectRestoreCommand.cs#L191-L220

nkolev92 avatar Aug 03 '22 21:08 nkolev92

I have the same problem, and I just added a reference to a project that contains this package. After that, it works fine.

izik89 avatar Jun 25 '23 12:06 izik89

I've had this error when I had solution open and .NET updates have been installing in background by Windows Update. I guess IDE cached old path, then path has got updated and build began to fail.

vladimir-bukreev avatar Sep 18 '23 19:09 vladimir-bukreev