I want to create and distribute a NuGet package that when installed only installs solution-wide to the root packages
-folder, referencing the package in the .NuGet\packages.config
file.
I have found some information on the NuGet package format in regards to this topic already and according to NuGet FAQ this should be possible if one follow these guidelines:
What is the difference between a project-level package and a solution-level package?
A solution-level package has to be installed only once in a solution to be available for all projects in the solution. A project-level package must be installed separately in each project where you want to use it. For solution-level packages, NuGet doesn't change anything in a project, whereas in a project-level package it does. Typically, a solution-level package installs new commands that can be called from within the Package Manager Console window.
Another Suggested SO solution states that the above should have worked too.
Thing is, I can't get it this to work. I have verified that my package has no lib or content directories:
I have put all the files to distribute in the tools
-folder in the package, including the init.ps1` script top run on install.
I am using Visual Studio 2015 and when I want to install the package:
:/
init.ps1
script does run and executes the commands as I want them to do. :)
packages
-folder is created in the project that I was forced to choose to get the installation done. I would have expected the packages
-folder to be created in the solution-root. :(
packages.config
file is created in the project-folder and not in .NuGet\packages.config
, as I'd expect after reading the docs I have found on this. :(
Any suggestions on how to get this working? Is this a VS 2015 limitation or a NuGet 3 change (as I believe it was included in VS2015)?
To launch the NuGet Package Manager for a Solution, you can go to the context menu for the Solution and select “Manage NuGet Package…”: When you search and try to add a new package, you can now select the projects you want to install the package into.
Building Your Package. Once you've created your .nuspec file, it's now time to build your package! Nuget.Org provides an application nuget.exe that is used to bundle your library into a Nuget package. You should already have this installed if you are using Visual Studio, or you can download it from nuget.org/downloads.
nuget.exe pack -IncludeReferencedProjects -properties Configuration=Release Using these options, Nuget will create a.nupkg that includes any referenced packages and projects. The package filename is automatically created, using the format [package id]. [package version].nupkg
Again, the generated.nuspec contains no explicit references to files in the folder structure. NuGet automatically includes all files when the package is created. You still need to edit placeholder values in other parts of the manifest, however. From an assembly DLL
The NuGet team deprecated solution level packages in NuGet 3.0.
There is a discussion about bringing them back in a way that is compatible with Visual Studio 2013 for a future version of NuGet.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With