How to setup single Nuget packages folder for multiple solutions and projects in Visual Studio 2015

不打扰是莪最后的温柔 提交于 2019-12-03 23:50:12

To resolve the issue, we put a NuGet.config file into the Codebase directory then deleted all the other Nuget.config files and .nuget folders in the solutions. Since NuGet configurations are propagated to sub folders, the settings in the single NuGet.config file are applied into all the solutions.

Inside the Nuget.config file we put the packageSource, repositoryPath settings.

Example NuGet.config file:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <config>
        <add key="repositoryPath" value="./SharedPackages" />
    </config>
</configuration>

Existing nuget packages need to be uninstalled and reinstalled since the dll references in .csproj files will still show the old packages folder. Or you can manually edit the .csproj files.

Resulting folder structure:

  • Codebase folder
    • Nuget.Config file
    • SharedPackages folder
    • SharedProjects folder
      • SharedProject1
    • SolutionA folder
      • WebProjectA
      • packages folder A
    • SolutionB
      • WebProjectB
      • packages folder B
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!