[英]How to update packages using Nuget.exe
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. 对于我在.NET中的小样本项目(直接在命令行上构建而不使用Visual Studio),我想直接使用
Nuget.exe
来检索我需要的库,而不必在源存储库中提交它们。
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). 在packages.config中指定所需的
packages.config
(如Visual Studio中的Nuget)。 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 但
Nuget.exe
抱怨说是
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. 我在互联网上搜索过,但我只在Nuget论坛上找到了类似的问题而没有答案。
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. 我已经阅读了Nuget项目中的相关源文件,我发现为了使更新成功,
Nuget.exe
需要找到一个Visual C#/ Basic / F#项目。
I then created an empty csproj
file in the folder and I've been able to update the packages I've installed before. 然后我在文件夹中创建了一个空的
csproj
文件,我已经能够更新之前安装的软件包了。
I've made a small sample at https://github.com/edymtt/nugetstandalone that shows how to install and update packages with Nuget.exe
. 我在https://github.com/edymtt/nugetstandalone上做了一个小样本,展示了如何使用
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 . 更新2013-04-06 14:20 UTC我已经更新了示例,以显示如何使用
install
命令的-ExcludeVersion
标志来实现该示例。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.