NuGet将dll放在哪里? [英] Where does NuGet put the dll?

查看:693
本文介绍了NuGet将dll放在哪里?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试解决NuGet的源代码控制限制.

I am trying to work around NuGet's Source Control limitations.

为此,我需要进一步了解NuGet的工作原理.让我们举一个简单的例子.假设我有一个项目,并向其中添加了AutoMapper.当我添加它时,dll应该放在哪里?

To that end I need to know a bit more about how NuGet works. Lets take a simple example. Say I have a project and I add AutoMapper to it. When I add it where is the dll supposed to be put?

我问,因为它似乎不一致.有时,参考文献正在"Packages"文件夹中寻找dll:

I ask because it does not seem to be consistent. Sometimes the reference is looking for the dll the "Packages" folder:

有时它在Debug build输出文件夹中查找:

and sometimes it is looking in the Debug build output folder:

但是在两种情况下,packages.config文件中的AutoMapper行都是相同的:

But in both cases the AutoMapper line in the packages.config file is the same:

第一个示例:

<?xml version="1.0" encoding="utf-8"?>
<packages>  
  <package id="AutoMapper" version="1.1.0.118" />
  <package id="CommonServiceLocator" version="1.0" />
  <package id="Unity" version="2.1.505.0" />
</packages>

第二个例子:

<?xml version="1.0" encoding="utf-8"?>
<packages>
  <package id="NSubstitute" version="1.1.0.0" />
  <package id="AutoMapper" version="1.1.0.118" />
  <package id="CommonServiceLocator" version="1.0" />
  <package id="Unity" version="2.1.505.0" />
</packages>

那么,控制引用建立位置的是什么?以及如何使我仅使用软件包位置"? (当它使用调试"输出文件夹时,如果您为发行"进行编译,则这些引用将失败.)

So what is controlling where it sets up up the reference to? And how to I make it just use the Packages Location? (When it uses the Debug output folder those references fail if you to compile for "Release".)

沮丧注::我必须承认我发现NuGet是一个不错的主意,但除了简单的情况以外,还没有准备好. (我正在考虑只回到拥有我所有dll的lib文件夹.)

Frustrated Note: I have to admit that I am finding NuGet to be a cool idea, but not ready for anything but simple situations. (I am thinking about just going back to having a lib folder with all my dlls in it.)

我忍不住想知道我是否缺少某些东西,因为NuGet的普及程度很高.必须有某种方法可以使这项工作...

I can't help but wonder if I am missing something because NuGet has such wide spread adoption. There must be some way to make this work...

推荐答案

简短的答案是,如果从VS(使用PowerShell或对话框)安装VS的NuGet软件包,则其中包含的所有程序集都将从程序包"中引用.文件夹.

The short answer is that if you install a NuGet package from VS (either using PowerShell or the dialog), any assemblies that it contains will be referenced from the Packages folder.

请注意,VS具有一些古怪的行为,例如,如果您尝试构建而缺少packages文件夹,并且DLL存在于bin文件夹中,则它将引用切换到"bin"文件夹.也许那就是您所看到的?

Note that VS has some quirky behavior such that if you try to build and the packages folder is missing, AND the DLL exists in the bin folder, then it switches the reference to go to the 'bin' folder. Maybe that's what you are seeing?

如果不是这种情况,并且您有一组可复制的步骤,导致没有从Packages文件夹中引用程序集,请在 http://nuget.codeplex.com/.谢谢!

If that's not the case, and you have a reproducible set of steps that lead to assemblies being referenced NOT from the Packages folder, please open a bug on http://nuget.codeplex.com/. Thanks!

这篇关于NuGet将dll放在哪里?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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