简体   繁体   English

如何使用Nuget.exe更新包

[英]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.

相关问题 使用nuget.exe时是否有与Update-package -reinstall等效的文件? - Is there an equivalent to Update-package -reinstall when using nuget.exe? nuget.exe 更新为新的 csproj 格式 - nuget.exe update with new csproj format 使用nuget.exe命令行安装依赖项 - using nuget.exe commandline to install dependency 使用程序包还原时,是否可以自动更新.nuget文件夹中的nuget.exe? - Is there a way to automatically update nuget.exe in the .nuget folder when using package restore? 使用“ nuget.exe恢复解决方案”时,软件包文件夹中的版本号错误 - Wrong version number in packages folder when using “nuget.exe restore solution” 如何配置NuGet.exe命令工具行查找包的位置 - How to configure where NuGet.exe Command Tool line looks for packages 如何使用 powershell 中的 nuget.exe? - How to use nuget.exe from powershell? 如何让 nuget.exe 对 powershell 可见? - How to get nuget.exe visible for powershell? 如何使用nuget.exe命令行获取特定Visual Studio解决方案的软件包列表 - How to get list of packages of a particular Visual Studio solution with nuget.exe command line VSTS:nuget.exe 失败并返回代码:1 包无法恢复 - VSTS: nuget.exe failed with return code: 1 Packages failed to restore
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM