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

Created on 3 Jun 2017  路  15Comments  路  Source: dotnet/sdk

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

Most helpful comment

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.

All 15 comments

You are not getting this error because the first run experience is failing, it seems like you are getting this error because you have an invalid feed. The actual restore error you are getting is indicating that.

@emgarten in case he can tell exactly what is wrong from the error message above.

Check the nuspec under home/chenzheyou/.nuget/packages/Libuv/1.9.1 is valid. This error might indicate the the nuspec is corrupt or empty.

@emgarten size of all files under libuv are zero except license.txt, how to solve it?

@livarcocc So there is one more question, does failure of first run exp cause the restore fail? and how can i make this run properly?

i cleared nuget cache by run "dotnet nuget locals -c all", and made it succeed after restoring again. thank you @emgarten @livarcocc

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

I'm seeing the same behavior as @tylerd after installing .NET Core 2.0 preview 2 and targeting version 1.0.4 of the SDK using globa.json.

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.

That seems to work, thanks a lot for the explanation @livarcocc!

I ran into this issue after installing the 2.0 SDK as well, but uninstalling it didn't immediately resolve the issue.

After removing 2.0, the latest SDK on my (Win10) machine was 1.1.0-preview1-005098.

The issue was resolved by uninstalling 5098 and installing 5124 from https://github.com/dotnet/cli/tree/rel/1.1.0, after which the cache priming error did not reoccur.

Thanks to @livarcocc for the support.

I ran into this issue randomly. I didn't install any 2.0 SDK or nothing. Now I keep having to go through the decrompressing and expanding every time I use dotnet commands. The error I was getting was the one in this title. Nothing I did fixed it. dotnet clean or deleting the NuGet.Config file.
failed to create prime the nuget cache. new failed with 1

I did then remove the dotnet CLI's installed and installed the latest CLI from the site and now I'm getting this error.
failed to create prime the nuget cache. new failed with -2147352571

The above command, dotnet nuget locals -c all didn't work either.

For me the solution was to update the .NET Core SDK version in global.json from 1.0.0-rc4-004771 to 2.0.0.

The above solution seems to work. Looks like Yeoman needs an update of some kind? Because this exact version came from the Yeoman generator.

@horney0824 clear nuget cache also works for me, thanks.

Was this page helpful?
0 / 5 - 0 ratings