Defaulting Package Management to PackageReference

孤人 提交于 2019-12-04 13:56:27

In Visual Studio 2017 you can define the settings in a NuGet.Config file.

<configuration>
  <packageManagement>
    <add key="format" value="1" />
    <add key="disabled" value="False" />
  </packageManagement>
</configuration>

The format value can be 1 or 0. PackageReference = 1. Packages.config = 0.

The disabled flag is a bit confusing, at least to me. Setting it to False seems to disable the dialog prompt that asks you to choose which format to use on first package install. Looking at the code this disabled setting refers to a DoNotShowPackageManagementSelectionKey and the disabled value is then returned in the PackageManagementFormat.Enabled property. Which seems the wrong way around to me. I was trying disabled set to True and wondering why the dialog was being displayed.

If you have that NuGet.Config file at the same level as the solution or higher in the directory it should be picked up and used.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!