DLL参考问题 [英] Dll reference question

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

问题描述

大家好,
这可能很简单,但我会尝试一下;)

想象以下dll结构:

dll1
dll2
dll3

dll1引用dll2

dll3参考dll1

当我编译dll3时,编译器总是希望我也引用dll2.

这不是以某种方式与dll1中的引用一起传递的(它已经引用了dll2)

是否可以避免这种情况,或者是否有这种现象的原因?

最好的问候
Andy

Hi all,
this might be a simple one but I''ll giev it a try ;)

Imagine the following dll strcture:

dll1
dll2
dll3

dll1 references dll2

dll3 references dll1

when I compile dll3 the compiler always want''s me to also reference dll2.

Isn''t that somehow passed with the references in dll1 (it references dll2 already)

Can this be avoided or is there a reason for this behavior?

best regards
Andy

推荐答案

除非DLL3直接使用DLL2中的类型,否则无需引用DLL3中的DLL2.编译器给出的确切错误消息是什么?

[更新]
------------
好的,这是对您的评论的回应.发生的是DLL1公开了使用DLL2中定义的接口的公共方法或属性.现在,由于DLL3引用了DLL1,即使它不使用此方法/属性/接口,它仍需要能够解析DLL1中定义的所有类型的所有公共成员.因此,DLL3将需要对DLL2的引用.
Unless DLL3 uses a type from DLL2 directly, there is no need to reference DLL2 from DLL3. What is the exact error message the compiler gives you?

[Updated]
------------
Okay, this is in response to your comment. What''s happening is that DLL1 exposes a public method or property that uses an interface defined in DLL2. Now since DLL3 has a reference to DLL1, even if it does not use this method/property/interface, it still needs to be able to resolve all public members in all types defined in DLL1. Thus DLL3 will need a reference to DLL2.


这篇关于DLL参考问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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