Maintain an offline NuGet source

To restore nuget packages in an offline VM, at work we need to regularly add those packages in a folder. We do it from our local packages folder, running a command like this:

C:\MySolution\packages>..\.nuget\NuGet.exe init . D:\NuGetSource

Then on theĀ build server we configure a task to run this command before bulding the solution:

.nuget\nuget restore MySolution.sln -Source d:\NuGetSource

I’m sharing this, because I was thinking I could manually create a folder with the package name, then a subfolder with the version, then copy the nuspec and nupkg files. But the package I needed was never found. It seems that the init command I shared above adds also a sha512 file, this is the only difference and probably that’s why the package was not found.

Leave a Reply

Your email address will not be published. Required fields are marked *