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

前端 未结 15 1963
误落风尘
误落风尘 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:32

    It's now possible to control which folder the packages are installed into.

    http://nuget.codeplex.com/workitem/215

    Edit: See Phil Haack's comment on Dec 10 2010 at 11:45 PM (in the work item/the link above). The support is partially implemented in 1.0, but is not documented.

    According to @dfowler: Add a nuget.config file next to the solution with this:

    
    {some path here}
    
    

    There is a nuget package for creating the package folder override.

    Update for version 2.1

    As Azat commented, there is now official documentation on how to control the package locations. The release notes for 2.1 specifies the following configuration in a nuget.config file (see the release notes for a description of valid places to put the config files and how the hierarchical configuration model works):

    
      
        
      
      ... 
    
    

    This would change the packages folder for the configuration level you put the file in (solution if you put it in the solution directory, project in project directory and so on). Note that the release notes state:

    [...] if you have an existing packages folder underneath your solution root, you will need to delete it before NuGet will place packages in the new location.

提交回复
热议问题