Is it possible to change the location of packages for NuGet?

前端 未结 15 1931
误落风尘
误落风尘 2020-11-22 17:11

I have the following convention for most of my projects:

/src
    /Solution.sln
    /SolutionFolder
        /Project1
        /Project2
        /etc..
/lib
          


        
15条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-11-22 17:29

    Okay for the sake of anyone else reading this post - here is what I understand of the myriad of answers above:

    1. The nuget.config file in the .nuget folder is relative to that folder. This is important because if your new folder is something like '../Packages' that will put it where it always goes out of the box. As @bruce14 states you must do '../../Packages' instead

    2. I could not get the latest nuget (2.8.5) to find a packages folder outside of the standard location without enabling package restore. So once you enable package restore then the following should be added to the nuget.config file inside of the .nuget folder to change the location:

      
      
        ...
        
          
        
        ...
      
      
    3. (This is important) If you make ANY changes to the package folder location inside of the nuget.config files you must restart visual studio or close/reload the solution for the changes to take effect

提交回复
热议问题