间接引用的程序集复制到输出目录 - 组件缺失 [英] Copying indirectly referenced assembly to output directory - assembly is missing

查看:186
本文介绍了间接引用的程序集复制到输出目录 - 组件缺失的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可能重复:
  如何复制本地工作?

我有以下情况:

  • 有一个名为OLAF.Tools项目,该项目引用Microsoft.Data.SqlXml在C:\ Program Files文件\ SQLXML 4.0 \ BIN \ Microsoft.Data.SqlXml.dll。参考复制本地属性设置为True。当我打造bin目录中的项目,我可以同时看到OLAF.Tools.dll和Microsoft.Data.SqlXml.dll
  • 有一个名为OLAF.Generator一个控制台应用程序,该应用程序引用OLAF.Tools(我使用项目选项卡添加引用)。当我打造bin目录中的应用程序,我只能看到OLAF.Generator.exe和OLAF.Tools.dll - 没有Microsoft.Data.SqlXml.dll,什么supprises我。另一个奇怪的是,即使是缺少DLL的应用程序是否正确执行。

所以,我的问题是:

  • 为什么Microsoft.Data.SqlXml.dll不会被复制到OLAF.Generator控制台应用程序的bin文件夹?
  • 在应用程序是如何解决目录下Microsoft.Data.SqlXml.dll可以找到?

谢谢你,帕维尔

编辑1:(从响应之后的马克Gravell

EDIT 1: (after response from Marc Gravell)

@Marc Gravell :你的回答让我回味无穷,因为我可以发誓,我总能看到在主应用程序的bin目录间接依赖程序集。恕我直言,我不同意你的观点 - 直言:)

@Marc Gravell: Your answer gave me food for thought, as I could swore that I could always see indirectly dependant assemblies in main application's bin directory. And IMHO I don't agree with you - with all due respect :)

当然,引用不是物理级联(我们正在谈论的是强关系类,接口等) - 而这正是我想要的建设OLAF.Tools库时实现。该库提供一个抽象层,它包含了工厂和一个工厂接受作为参数串并返回接口。一种特定实现该接口的使用Microsoft.Data.SqlXml组件。结果是, OLAF.Generator使用将位于OLAF.Tools接口,但是不知道关于在Microsoft.Data.SqlXml组件。

Of course, references are not cascaded physically (we're are talking about strong relationship to classes, interfaces etc) - and it's exactly what I wanted to achieve when building OLAF.Tools library. That library provides a level of abstraction, it contains factories, and one factory accepts as a parameter string and returns interface. One particular implementation of that interface uses Microsoft.Data.SqlXml components. As a result, OLAF.Generator uses interface that is located in OLAF.Tools, but doesn't know about components in Microsoft.Data.SqlXml.

除此之外,(我想大家都知道我的尝试在preceding段解释),构建应用程序时,相关的组件应该复制(如复制本地设置为TRUE)。我刚写的示例应用程序,项目B LIB有参考项目A的lib和项目C(控制台应用程序)的参考项目B的项目C的bin目录下我可以看到:项目A.DLL,项目B.DLL和放大器;项目C.exe。因此,在讨论的情况下,为什么Microsoft.Data.SqlXml不会结束在OLAF.Generator bin文件夹的原因有事情做与集本身。

Apart from that (I think we both know what I tried to explain in preceding paragraph), when building application, dependant assemblies should be copied (if Copy Local is set to TRUE). I just wrote sample application, Project B lib has reference to Project A lib, and Project C (console app) has reference to Project B. In Project C's bin directory I can see all: Project A.dll, Project B.dll & Project C.exe. So in discussed scenario, the reason why Microsoft.Data.SqlXml doesn't end up in OLAF.Generator bin folder has something to do with that assembly itself.

是否编译/视觉工作室都知道,Microsoft.Data.SqlXml位于目录这是自动探测(或它在GAC),这就是为什么该程序集是不可复制的原因是什么?

Does compiler/visual studio knows that Microsoft.Data.SqlXml is located in directory which is automatically probed (or it's in GAC) and this is the reason why that assembly is not copied?

编辑2:我刚刚查GAC,而事实上,Microsoft.Data.SqlXml.dll安装在GAC

EDIT 2: I've just checked GAC, and indeed, Microsoft.Data.SqlXml.dll is installed in GAC.

推荐答案

如何复制本地工作 - ?这是回答我的问题。当库被安装在GAC中,它不会被即使复制本地设置用于复制

How does Copy-local work? - this is answer to my question. When library is installed in GAC, it won't be copied even though COPY LOCAL setting is used.

这篇关于间接引用的程序集复制到输出目录 - 组件缺失的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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