While trying to get a nuget build workflow working on Linux/mono, I've noticed an odd thing.
Being on Linux, I cannot use the nuget Visual Studio plugin or the Powershell console, but I have the nuget.exe command-line utility. This utility has an "install" command which properly fetches packages and places them in my packages directory.
However, nuget.exe's install (as opposed to the Visual Studio install) doesn't appear to update packages.config with the packages it added, nor does it add project references to my .csproj. The latter is less important (I can do it manually), since the packages.config needs to contain recursive dependencies as well I can't do it manually...
Has anyone else tried to install new packages solely using nuget.exe or has any insight into this? Am I barking up the wrong tree entirely?
Use nuget update -self on Windows to update an existing nuget.exe to the latest version. The latest recommended NuGet CLI is always available at https://dist.nuget.org/win-x86-commandline/latest/nuget.exe .
Switch to the Browse tab, search for the package name, select it, then select Install). For all packages, delete the package folder, then run nuget install . For a single package, delete the package folder and use nuget install <id> to reinstall the same one.
Open your project or solution in Visual Studio, and select Tools > NuGet Package Manager > Package Manager Console to open the Package Manager Console window. In the console, enter Find-Package with a keyword to find the package you want to install.
In Visual Studio, use the Help > About Microsoft Visual Studio command and look at the version displayed next to NuGet Package Manager. Alternatively, launch the Package Manager Console (Tools > NuGet Package Manager > Package Manager Console) and enter $host to see information about NuGet including the version.
As it currently (Nuget 2.8.1) stands, this is still not possible and a major shortcoming of the nuget command line client, as I see it.
Nuget.exe must be able to install a package and add it to the packages.config
with all dependencies to be usable for anything more than the most simple cases.
I have created an issue, see https://nuget.codeplex.com/workitem/4258
For the time being, the following approach can be used. Note that it is far from optimal, but at least enables you to use nuget and resolve dependent packages correctly.
Resort to managing the packages.config
manually. Add the packages you need, but omit their dependencies. Note that this is different from "ordinary" packages.config
files, which do list the dependencies as well.
Use a script to walk the packages.config
and issue a nuget install <package-id> -Version <version>
for each package. This will install the package and its dependencies.
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