如何在两个不同的DLL中访问具有相同完全限定名称的类型 [英] How to access a type with same fully qualified name in 2 different DLLs

查看:202
本文介绍了如何在两个不同的DLL中访问具有相同完全限定名称的类型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要参考两个程序集 PresentationFramework.Classic PresentationFramework.Luna ,我有一种情况我需要使用 Microsoft.Windows.Themes.DataGridHeaderBorder 类型。但是,由于两个程序集都定义了这种类型,所以会产生错误。
我的意思是说,我可以提到这个类型的任何一个(Classic或Luna),这只是一个简单的Datagrid,在这里我需要检查 DataGridHeaderBorder 被点击。

I need to refer to both the assemblies PresentationFramework.Classic and PresentationFramework.Luna and I have a situation where I need to use the Microsoft.Windows.Themes.DataGridHeaderBorder type. But this gives error as both the assemblies have this type defined. I mean, I can do with referring to any of them (Classic or Luna) for this type, it's just a simple Datagrid, where I need to check if the DataGridHeaderBorder is clicked.

提前感谢

推荐答案

这是一种情况外部程序集别名旨在解决。如果命令行编译不是您的事情,也可以使用Visual Studio中引用的属性表中的别名属性指定引用的别名。请参阅 http://blogs.msdn.com/b/ ansonh / archive / 2006/09/27 / 774692.aspx 获取完整示例。

This is the sort of situation that external assembly aliases are intended to address. You can also specify the alias for a reference using the "Aliases" property in the reference's properties sheet in Visual Studio if command line compilation isn't your thing. See http://blogs.msdn.com/b/ansonh/archive/2006/09/27/774692.aspx for a full example.

这篇关于如何在两个不同的DLL中访问具有相同完全限定名称的类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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