【问题标题】:Nuget updates packages during build even when configured to notNuget 在构建期间更新包,即使配置为不
【发布时间】:2015-09-19 18:26:52
【问题描述】:

工具->选项->Nuget 包管理器->常规

我已经像这样配置了 nuget:

[ ] Allow NuGet to download missing packages
  [ ] Automatically check for missing packages during build in Visual Studio

当我构建我的项目时,我收到这样的消息:

33>  Restoring NuGet packages...
33>  To prevent NuGet from downloading packages during build, open the Visual Studio Options dialog, click on the Package Manager node and uncheck 'Allow NuGet to download missing packages'.
33>  All packages listed in packages.config are already installed.

但我没有选中该选项,那为什么我会收到这些消息?

【问题讨论】:

    标签: visual-studio visual-studio-2013 nuget nuget-package-restore


    【解决方案1】:

    这是因为您的项目正在使用旧的现已弃用的 NuGet 包还原,它基于 MSBuild 并在每次构建时运行 NuGet.exe。这些消息来自 NuGet.exe。

    为防止这种情况发生,您应该能够在每个项目文件中将 RestorePackages 设置为 false,但 NuGet 似乎出于某种原因希望继续将其设置回 true。

     <RestorePackages>false</RestorePackages>
    

    另一种方法是不使用基于 MSBuild 的 NuGet 包还原并将其删除。然后,如果您在 Visual Studio 中构建,并且使用的是最新版本的 NuGet 包管理器,那么在构建之前,Visual Studio 将自动恢复 NuGet 包。

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2013-02-08
    • 1970-01-01
    • 2012-06-30
    • 1970-01-01
    • 2021-01-31
    • 2014-10-25
    • 2015-07-12
    • 2019-11-26
    相关资源
    最近更新 更多