为什么必须链接参考程序集? [英] Why must I chain reference assemblies?

查看:74
本文介绍了为什么必须链接参考程序集?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的项目引用一个程序集(将其称为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,Version = 9.1.2.0,Culture = neutral,
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屋!

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