Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MSBuild NuGet.targets ,Nuget.exe : Unable to read package from path 'blah.nupkg' error

I am getting these errors when running a MSBuild build step that builds a web project in TeamCity and I have setup my Nuget targets file PackageSource to point to a local Nuget server e.g. PackageSource Include="http://mylocaldevurl/nuget/Packages" .

The build runs and produces errors of the form e.g. Exec] F:\TeamCity\buildAgent\work\blahblah.nuget\NuGet.targets(87, 9): Unable to read package from path 'Lucene.Net.3.0.3.nupkg'.

Whats is strange other packages are downloaded fine to the TeamCity working folder -the package folder.

The local Nuget Server contains copies of my VS solution packages(the ones in the default packages folder) with only the .nupkg files.

My question is there something that I need to do when copying the .nupkg files to that server.I might be missing something.

I have already doubled checked that the packages exist in the local Server

like image 709
kwiri Avatar asked Aug 14 '13 10:08

kwiri


People also ask

How do I restore a Nupkg file?

config file. You can restore packages manually with nuget restore , dotnet restore , msbuild -t:restore , or through Visual Studio. The dotnet build and dotnet run commands automatically restore packages, and you can configure Visual Studio to restore packages automatically when it builds a project.

How do I install a Nupkg file in Windows?

Menu Tools → Options → Package Manager Click OK. Drop your NuGet package files in that folder. Go to your Project in Solution Explorer, right click and select "Manage NuGet Packages". Select your new package source.


1 Answers

I had this same problem using TFS. What I did that fixed it was clear the nuget cache in the user profile that was running the build (%LocalAppData%\NuGet\Cache). I just emptied the directory and ran the build again, then it worked.

like image 146
GrokSrc Avatar answered Oct 21 '22 01:10

GrokSrc