是有可能改变包的位置的NuGet? [英] Is it possible to change the location of packages for NuGet?

查看:984
本文介绍了是有可能改变包的位置的NuGet?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下约定我的大部分项目:

I have the following convention for most of my projects:

/src
    /Solution.sln
    /SolutionFolder
        /Project1
        /Project2
        /etc..
/lib
    /Moq
        moq.dll
        license.txt
    /Yui-Compressor
        yui.compressor.dll
/tools
    /ILMerge
        ilmerge.exe

您会发现,我做的没有的保持外部库的的源文件夹。我也使用的NuGet很感兴趣,但不希望在源文件夹中的这些外部库。确实的NuGet必须要更改的设置,所有的包都加载到目录?

You'll notice that I do not keep external libraries inside the source folder. I'm also very interested in using NuGet but don't want these external libraries inside the source folder. Does NuGet have a setting to change the directory that all packages are loaded into?

推荐答案

这是现在可以控制哪些文件夹安装到包。

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

HTTP://nuget.$c$cplex.com/workitem/215

编辑: 查看二〇一〇年十二月一十日菲尔哈克的评论晚上11:45(在工作项/上面的链接)。支持在1.0部分执行,但没有记录。

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.

据@dfowler: 旁边的添加与此解决方案nuget.config文件:

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

<settings>
<repositoryPath>{some path here}</repositoryPath>
</settings>

一个的NuGet包用于创建包文件夹覆盖。

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

更新为2.1版本

由于阿扎特评论说,现在对如何控制包位置的官方文件。该<一href="http://docs.nuget.org/docs/release-notes/nuget-2.1#Specify_%e2%80%98packages%e2%80%99_Folder_Location">release笔记2.1 指定一个nuget.config文件中的下列配置(参见有效地说明,把配置文件,以及如何分层配置模型作品的发行说明):

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):

<configuration>
  <config>
    <add key="repositoryPath" value="C:\thePathToMyPackagesFolder" />
  </config>
  ... 
</configuration>

这将改变包文件夹,​​放在(和解决方案,如果你把它在解决方案目录,项目在项目目录等)的文件中的配置水平。请注意,发行说明状态:

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:

[...]如果你有你的解决方案下现有的包文件夹   根,你将需要删除它之前的NuGet将会把软件包   新的位置。

[...] 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.

这篇关于是有可能改变包的位置的NuGet?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆