为什么我必须链接引用程序集? [英] Why must I chain reference assemblies?
问题描述
我的项目引用了一个程序集(称为 X),该程序集引用了另一个程序集(称为 Y).
My project references an assembly (will call it X) that references another assembly (will call it Y).
当我尝试编译我的项目时,它要求它应该引用程序集 Y.这是为什么?我在引用程序集 X 的行上收到以下错误:
When I try to compile my project, it demands that it should reference assembly Y. Why is that? I get the following error on the line where assembly X is referenced:
'DevExpress.XtraEditors.XtraForm' 类型在程序集中定义没有被引用.您必须添加对程序集的引用'DevExpress.Utils.v9.1,版本=9.1.2.0,文化=中性,PublicKeyToken=b88d1754d700e49a'.
The type 'DevExpress.XtraEditors.XtraForm' is defined in an assembly that is not referenced. You must add a reference to assembly 'DevExpress.Utils.v9.1, Version=9.1.2.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a'.
DevExpress.XtraEditors.XtraForm
是程序集 Y.
这是为什么?我以前从未见过这种行为.
Why is this? I have not seen this behavior before.
推荐答案
这个一直都有.如果您使用的是从程序集 Y 获取方法/属性/成员等的对象,则只会在编译时获取这些.
This has always been in place. You will only get these at compile time if you're using an object that gets methods/properties/members etc from assembly Y.
这是因为.NET不能依赖程序集X来确保它能够获得正确的符号和元数据信息.
The why is because .NET cannot rely on assembly X to ensure it will be able to obtain proper symbol and meta data information.
这篇关于为什么我必须链接引用程序集?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!