有没有办法在使用包还原时自动更新 .nuget 文件夹中的 nuget.exe? [英] Is there a way to automatically update nuget.exe in the .nuget folder when using package restore?

查看:48
本文介绍了有没有办法在使用包还原时自动更新 .nuget 文件夹中的 nuget.exe?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

自 Nuget 1.5 以来,我的团队一直在使用启用包还原"选项来使包不受我们的源代码控制.当 Nuget 1.6 发布时,我们注意到一个问题,它没有将包拉下来,并追踪到 .nuget 文件夹中的 Nuget.exe 需要更新到 1.6 以匹配包管理器.

My team has been using the Enable Package Restore option since Nuget 1.5 to keep packages out of our source control. When Nuget 1.6 was released we noticed an issue where it wasn't pulling the packages down, and tracked it down to the Nuget.exe in the .nuget folder needed to updated to 1.6 to match the Package Manager.

更新 Nuget 后更新解决方案的最佳方法是什么?我没有从工作室看到一种简单的方法来判断解决方案文件夹中的 nuget 版本.到目前为止,我们清除了 .nuget 文件夹并重新运行了 Enable Package Restore 命令.

What's the best way to update a solution once Nuget has been udpated? I don't see an easy way from studio to tell which version of nuget is in the solution folder. So far we blow away the .nuget folder and re-run the Enable Package Restore command.

推荐答案

我建议使用命令行中的以下命令更新 .nuget\nuget.exe:

I would suggest updating .nuget\nuget.exe with this command from the command line:

nuget.exe update -self

:首先关闭 VS 解决方案.如果有更新并且打开了解决方案,nuget.exe 将从解决方案中删除.

: Close VS Solution first. If there's an update and the solution is opened, nuget.exe will be removed from the solution.

可以通过修改 .nuget\nuget.targets 添加上述命令,在还原时自动更新 nuget.exe.我会以那里的 restore 命令为例.但我不确定这是否值得,nuget.exe 更新并不常见,向后兼容性应该很少会中断.

You could automatically update nuget.exe on restore by modifying the .nuget\nuget.targets to add the above command. I'd look at the restore command in there as an example. But I'm not sure if it's worth it, nuget.exe updates aren't that common, and backward compatibility should break very rarely.

这篇关于有没有办法在使用包还原时自动更新 .nuget 文件夹中的 nuget.exe?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆