NuGet - Nuspec file does not exist in package Error Message

I just spent a lot of time trying to troubleshoot why packages wouldn't restore on my CI/CD server.

It turned out to be cause by the NuGet cache.

TLDR: Clear the NuGet cache with the following command. Note: You'll need the NuGet.exe. Command: nuget locals all -clear

I was getting an error saying C:\Program Files\dotnet\sdk\2.1.403\NuGet.targets(114,5): error NU5000: Nuspec file does not exist in package. which didn't make sense since this worked fine on my workstation.

I isolated the problem to a specific package: Microsoft.NET.Test.Sdk. I tried several version including 15.9.0, 15.9.0-preview-20180924-03, 15.8.0, 15.7.2 the latter being the most popular release.

They all gave the error which lead me to try to clear the cache. I used the command above and the issue was fixed.

Note: I don't believe the specific package had anything to do with it. It was just a symptom of a larger problem.

Frank Villasenor

Frank Villasenor

Owner and principal author of this site. Professional Engineering Lead, Software Engineer & Architect working in the Chicagoland area as a consultant. Cert: AWS DevOps Pro
Chicago, IL