Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adding NuGet package present on hard drive (Not hosted anywhere) to a project

MY Task is to generate a NuGet package of one project containing static content and binaries. Then means by which this NuGet package can be consumed in another Project/ Solution.

I have completed the first half of the task where i was able to generate a NuGet package out of a project, but not sure how to consume this inside another project/ solution. I see only option of adding already published Projects from NuGet repository but not anything which is out there on file system/ hard drive.

Any help is appreciated.

Thanks in advance.

like image 818
Bhargava Avatar asked Apr 01 '13 18:04

Bhargava


People also ask

How do I manually add NuGet to project?

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.

How do I store NuGet packages locally?

Enable package restore by choosing Tools > Options > NuGet Package Manager. Under Package Restore options, select Allow NuGet to download missing packages. In Solution Explorer, right click the solution and select Restore NuGet Packages.

How do I add a local NuGet package to Visual Studio?

From Visual Studio's menu, select Tools > Options, and then enter NuGet in the search input. Select the suitable Package Sources, as shown in Figure 1, followed by clicking the green plus button to add your path from set up local feed folder. Provide a name, and then click the OK button.


1 Answers

You need to add the directory which contains the package as a NuGet Package Source. In Visual Studio do the following

  • Tools -> Options
  • Package Manager -> Package Sources
  • Add the file system location and hit "Update"

After this the local package should appear in the Package Library Manager

If you are looking to change the NuGet.exe command line then create a Nuget.exe.config file and add the following

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <packageSources>
    <add key="LocalName" value="path/to/your/package" />
  </packageSources> 
</configuration>
like image 157
JaredPar Avatar answered Oct 15 '22 09:10

JaredPar