NuGet 将 DLL 文件放在哪里? [英] Where does NuGet put the DLL file?

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

问题描述

我正在尝试解决 NuGet 的.

I am trying to work around NuGet's source control limitations.

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

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

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

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

First example:

<?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>

Second example:

<?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 do I make it just use the Packages Location?

(When it uses the Debug output folder those references fail if you to compile for "Release".)

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

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

解决方案

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

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

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/.

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

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