Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Use packages.config to install local NuGet package?

I want to install a NuGet package (so a .nukpg file) that I have stored in a directory. This is easy to do with a batch script, using the NuGet command line, but is there a way to do this using the built in "packages.config" file?

like image 302
BWG Avatar asked Jan 19 '26 03:01

BWG


1 Answers

Yes, you can reference a local file from your packages.config. You need to update your NuGet.Config file and add something like this to the <packageSources> section:

<packageSources>
  <add key="MyLocalPackages" value="external/packages" />
</packageSources>

value is the path to where your packages can be found.

Then in your packages.config just reference the version that is in your local package directory, like:

<package id="Foobar" version="1.1.5-alpha" targetFramework="net45" />
like image 61
bratsche Avatar answered Jan 20 '26 21:01

bratsche