question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Failed to create prime the NuGet cache. restore failed with: 1

See original GitHub issue

Steps to reproduce

dotnet restore

Expected behavior

Successfully finished.

Actual behavior

Failed to create prime the NuGet cache. restore failed with: 1 Restoring packages for /home/chenzheyou/hwapp/hwapp.csproj… /usr/share/dotnet/sdk/1.0.4/NuGet.targets(97,5): error : An error occurred while retrieving package metadata for ‘Libuv.1.9.1’ from source ‘/home/chenzheyou/.nuget/packages/’. [/home/chenzheyou/hwapp/hwapp.csproj] /usr/share/dotnet/sdk/1.0.4/NuGet.targets(97,5): error : Root element is missing. [/home/chenzheyou/hwapp/hwapp.csproj]

Environment data

dotnet --info output:

.NET Command Line Tools (1.0.4)

Product Information: Version: 1.0.4 Commit SHA-1 hash: af1e6684fd

Runtime Environment: OS Name: ubuntu OS Version: 16.04 OS Platform: Linux RID: ubuntu.16.04-x64 Base Path: /usr/share/dotnet/sdk/1.0.4

Note

Ubuntu is run under VM Player

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:15 (3 by maintainers)

github_iconTop GitHub Comments

7reactions
livarcocccommented, Jul 20, 2017

This is a known issue with 1.0.4 installed side-by-side with a 2.0 SDK. I would recommend temporarily removing the 2.0 SDK, running the first run for 1.0.4 and then putting 2.0 back. This happens because as part of the first run experience, we shell out to dotnet to invoke dotnet new -f netcoreapp1.0. With 2.0 on the path, the 2.0 SDK gets picked to run this command, but it does not have a template for that TFM, and so it fails.

We have fixed that in the 1.1.0-preview1 SDK, in which we make sure that dotnet new is shelled out to the same SDK that triggered the first run experience. And in the 2.0 SDK, we remove this entirelly, and all we do is expand the offline cache, so that it is simpler and faster.

Sorry for the inconvenience. I am going to keep this issue closed since it has also been ported to the 1.0 SDK, we just haven’t had an official release of it yet.

7reactions
tylerdcommented, Jul 7, 2017

Clearing all of the local nugget caches did not fix the issue for me.

I started getting this error after targeting an older version of the .net core SDK (1.0.4) using the global.json file. I have multiple versions of the .net core SDK on my machine

Read more comments on GitHub >

github_iconTop Results From Across the Web

Failed to create prime the NuGet cache, dotnet restore.
I ran into this problem after upgrading to VS 15.6. I was able to get around the issue by temporarily moving all SDKs...
Read more >
Failed to create prime the NuGet cache. new failed with: - ...
Failed to create prime the NuGet cache. new failed with: -2147352571. The restore succeeds, but it takes about 45 seconds every time.
Read more >
Unable to restore nuget packages - ASP.NET Core
Failed to create prime the NuGet cache. restore failed with: 1. error: Unable to obtain lock file access on '/tmp/NuGetScratch/lock/[random text] for ...
Read more >
WSL dotnet clean "Failed to create prime the NuGet cache. ...
WSL dotnet clean "Failed to create prime the NuGet cache. restore failed with: 1" · Steps to reproduce. Navigate to project root and...
Read more >
.Net core (Example) | Treehouse Community
Decompressing 100% 18653 ms Expanding 100% 660525 ms Failed to create prime the NuGet cache. restore failed with: 1 Content generation time: ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found