How to put Nuget libraries on a folder - nuget

i generally add any library from Nuget to my project like issuing this command
Install-Package Mvc3Futures
then i have seen everything related to that library just added in my project. some one told me that library can be added to folder and later we can add that folder to my project like this way tools > options > package manager - add your folder .
really i have no idea how we can add library to any folder from Nuget. if it is possible then please show me the way in step-by-steps. thanks

I cannot give you a step-by-step, but you can relocate/specify the place of the packages folder: Is it possible to change the location of packages for NuGet?. But this way all of your packages location will change, I don't think you can do that per package. During installation you can specify where you install the package from (but not to): http://docs.nuget.org/docs/reference/command-line-reference, see Install Command.

Related

Internal NuGet install fails to install

I setup an internal NuGet server to host internal dll packages. The setup went smoothly. The spec and nupkg were created successfully. However, when I launch a test project and attempt to install it from Manage NuGet Packages it fails.
The internal package shows up under Manage NuGet Packages with an install button. I hit install but it does nothing. I check my references folder and saw nothing added.
If I check the Manage NuGet Packages at solution level, it has a green check mark indicate that it's installed but doesn't give me a Manage option to see which project it was installed to.
My issue is somewhat similar to this post below. The only difference is that I don't have sub folders for my library. I just have 1 dll and I'm putting the nupkg file directly under the Packages folder.
NuGet package fails to install
I'm not sure what I did wrong. Any suggestions?
Thanks to #MattWard for mentioned that the package got installed at the solution level. I went back to the official documentation here: https://docs.nuget.org/create/creating-and-publishing-a-package to review the differences with creating solution level package vs project level package and most important of all is the nuget naming convention when creating packages (the lib, content, etc. folder). I re-package my dll again with the naming convention and it works!

Cannot use home-made NuGet package

I'm investigating using NuGet internally to share an assembly used across multiple solutions. Despite the documentation making it look simple, I'm just getting a faceful of problems. I have two questions at this stage:
1) When I create the package, NuGet reports it as having 'no dependencies'. In fact, the assembly's project has quite a few dependencies on other (official) NuGet packages. I assumed that NuGet would spot this. Is there something I need to do so that NuGet knows my assembly itself has NuGet dependencies?
2) When I attempt to add the package to a project in another solution, it doesn't actually add the dll to the project (i.e. in the project's References). The package manager GUI lists the package in the installed list, but doesn't show a 'Manage' button, as it does for other packages. Instead, it just shows a 'Uninstall' button. So it's as if the overall solution is now aware of my package, but I can't add it as a reference to any projects, which is obviously of no use. This happens regardless of whether I install using the GUI or the command line. Does anyone know why this might be happening?
Thanks in advance.
For issue 1, if you are using nuget.exe pack and your project installed certain packages, these packages will be added as dependencies. If the packages are installed to another project that the main project is referencing, do nuget.exe pack -includereferencedprojects. For more information, please refer to http://docs.nuget.org/docs/reference/command-line-reference#Pack_Command_Examples.
For issue 2, you have probably installed a solution-level package, which does not have Content or Lib folder inside. If you install a project-level package, you should be able to see the manage button.
Hope this helps.

NuGet and Portable Class Libraries - Package doesn't target any framework

I have been using NuGet to manage my internally created assemblies for a few months, and it's working very well. I recently 'discovered' portable class libraries, which has also been great - until it's time to install the packages.
Say I have a PCL that targets .NET 4.5, SL5 and .NET for Windows Store Apps. I run nuget spec to create the .nuspec file, edit the values, package it up, and add the .nupkg to our internal feed. If I open the .nupkg file in the Package Explorer, I see one content folder under lib called portable-win+net45+sl50.
When I try to install the package from any compatible project in another solution, I get the following message:
"'Project.PCL' could not be installed because it is not compatible with any project in the solution. The package doesn't target any framework."
If I manually create the .nupkg in the Package Explorer, updating the version number, adding a lib folder for each targeted framework (not a portable folder) and added the Project.PCL.dll to each folder, I can add the package to the compatible projects in the solution. But to do this process every time I want to update a PCl is somewhat tedious (I had been creating a little .cmd file in the project root folder to quickly package and deploy).
Do other people have this problem? How can I package PCL's in the same way as other types of projects?
Note - I'm using VS 2012 Ultimate and NuGet 2.2
It sounds like maybe nuget spec doesn't work for Portable Class Libraries - that's worth starting a thread or filing an issue on the NuGet site.
However, you can also create a .nuspec file from NuGet Package Explorer. Just create the package as you already did, but then choose "Save Metadata As..." to save it as a .nuspec. Afterwards you may need to edit the source paths in the nuspec file manually, but you should be able to automate the creation of the package.
For me nuget spec and nuget pack worked fine with a portable project while creating the package and installing it on a compatible project.
Do you want to check if you have the latest nuget.exe (2.2), it can be downloaded from http://nuget.org/nuget.exe or can be updated by running nuget update -self

How to package 2 third-party dll's

I'm reading through the nuget documentation and I don't completely understand how nuget works.
I have 2 third party dll's that I have been asked to turn into a nuget package, so that our local developers can just install them to a project via nuget. This would be something that we would host locally.
Does this mean I just create a project in vs and drop the dll's in the project or do I use something like the package explorer.
I apologize in advance if this is a silly question, however I am an absolute beginner when it comes to Nuget, etc..
Any tips would be greatly appreciated.
The simplest and fastest way to get a nuget package up and running is to just fire up package explorer --> create a new package --> drag and drop your dlls into the "Package Contents" area, it'll ask you whether you want the dlls in the "lib" folder, which you do --> create a bit of metadata about the package, ie give it a description and version and whatnot, and then just save it.
After you save it, you can then copy the .nupkg file to a shared location - the file system on a centralised server is fine if you have access to one, and then setup access to this "feed" (ie, the shared folder) in visual studio (tools --> options --> Package Manager --> Package Sources), thus:
Or if you want to host the packages over http you can follow the instructions here: https://github.com/NuGet/NuGetGallery/blob/master/README.markdown.
Other option would be to use Nuget.exe spec, pack commands to quickly create package.
More details here # http://docs.nuget.org/docs/reference/command-line-reference

Nuget package doesn't install into individual projects?

I've added several Nuget packages to my multi-project solution with no issues. However, when I add this package -- ews.x64 (Exchange Web Services API) -- Nuget does not allow me to add it to any particular project.
The packages subfolder is created normally:
D:\TFSSource\Exchange\Utilities\Src\ExchangePurge\packages\EWS.x64.1.2
but when you attempt to manage the solution's installed packages, the "Manage Nuget Packages" dialog only offers an Uninstall button for this particular package. All the other packages have the Manage button allowing them to be added to the individual projects.
Also interesting is the fact that this package appears in a packages.config file under a newly created solution folder called .nuget? Any ideas what might be causing this?
Looks like this is a solution-level package, a package that doesn't have project specific content or libraries. The package is probably installed correctly and available to all projects at once.
source:NuGet FAQ