For my little sample projects in .NET (built directly on the command line without employing Visual Studio) I want to use directly Nuget.exe
to retrieve the libraries I need, without having to commit them in the source repository.
I've been able to install them using the command
nuget install packages.config -o $destinationFolder
specifying the needed packages in a packages.config
(like Nuget in Visual Studio).
However, I'm unable to update installed packages. I've tried to use this command
nuget update packages.config -r $destinationFolder
but Nuget.exe
complains that is
unable to locate project file for '...packages.config'`.
I've searched on the Internet but I only find a similar question in the Nuget discussion forums without answers.
In Visual Studio, the Package Manager Console provides many flexible options for updating and reinstalling packages. On the Installed tab, select a package, record its name, then select Uninstall. Switch to the Browse tab, search for the package name, select it, then select Install).
The NuGet ( nuget.exe ) CLI, provides the full extent of NuGet functionality to install, create, publish, and manage packages without making any changes to project files.
I've read the relevant source files in the Nuget project and I've discovered that for the update to succeed Nuget.exe
needs to find a Visual C#/Basic/F# project.
I then created an empty csproj
file in the folder and I've been able to update the packages I've installed before.
I've made a small sample at https://github.com/edymtt/nugetstandalone that shows how to install and update packages with Nuget.exe
. I've also used a workaround to make sure that only the latest versions of the libraries are kept in the folder.
Update 2013-04-06 14:20 UTC I've updated the sample to show how to achieve that using the -ExcludeVersion
flag of the install
command.
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