如何在启动解决方案时禁用还原 NuGet 包 [英] How do I disable restoring NuGet packages while starting the solution

查看:66
本文介绍了如何在启动解决方案时禁用还原 NuGet 包的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

每次启动我的解决方案(65 个项目、UWP、WPF、NetStandard)时,我都可以在输出窗口(包管理器)中看到 NuGet 正在恢复包.此任务需要大约 26 秒.我想知道这是否有必要,因为为什么每次启动解决方案时我都想恢复包?如果我能禁用它就太好了.

every time I start my solution (65 projects, UWP, WPF, NetStandard) I can see in my output window (Package Manager) that NuGet is restoring packages. This task needs about 26 seconds. I wonder if this is necessary because why should I want to restore the packages every time I start the solution? It would be great if I could disable it.

我使用的是 Visual Studio 15.2 (26430.16)

I am using Visual Studio 15.2 (26430.16)

感谢您的帮助!

推荐答案

您看到的还原是自动还原,它只能在基于 SDK 的项目上运行.https://docs.microsoft.com/en-us/nuget/consume-packages/package-restore#automatic-restore-in-visual-studio

The restore you are seeing there is Auto-Restore which will only run on SDK based projects. https://docs.microsoft.com/en-us/nuget/consume-packages/package-restore#automatic-restore-in-visual-studio

目前无法明确禁用自动还原,但您可以禁用还原本身.请注意,这将禁用所有还原(在构建/重建和解决方案中右键单击还原)

There is currently no way to disable auto-restore explicitly but you can disable restore itself. Note that this will disable all restore (on build/rebuild & solution right click restore)

https://docs.microsoft.com/en-us/nuget/consume-packages/package-restore#enabling-and-disabling-package-restore

转到工具 -> 选项 -> NuGet 包管理器 -> 常规 -> 包还原.第一个选项禁用还原本身,而第二个选项禁用构建还原.

Go to Tools -> Options -> NuGet Package Manager -> General -> Package Restore. The first option disables restore itself, while the 2nd option disables on build restore.

NuGet 尝试还原以确保未从磁盘中删除包或未删除资产文件(有助于智能感知).这是完整的视觉工作室体验的组成部分.15.3(将在 2 周内发布)中有一些改进,如果还原是在之前的某个时间点完成并且包引用、源等没有更改,则会改善启动时的还原体验.

NuGet tries to restore to make sure that the packages were not deleted from disk or that the assets file (which helps the intellisense) is not deleted. This is integral to the complete visual studio experience. There are improvements in 15.3 (to be released within 2 weeks) that would improve the restore experience on start-up if restore was done at some point previously and if there are no changes to the package references, source etc.

这篇关于如何在启动解决方案时禁用还原 NuGet 包的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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