如何允许同一个命名空间的两个DLL存在于同一个应用程序中? [英] How do you allow two DLL's with same namespace.class to exist in the same application?

查看:220
本文介绍了如何允许同一个命名空间的两个DLL存在于同一个应用程序中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

具体来说,我们正在尝试将telerik控件升级到最新版本。不幸的是,旧的DLL很旧,许多控件属性发生了很大变化,所以我们决定只升级提供问题的telerik控件(RadEditor控件)。



所以bin看起来像这样:

  RadChart.Net2.dll 
RadEditor.Net2.dll (我们只想摆脱这一个)
RadGrid.Net2.dll
RadInput.Net2.dll
RadPanelbar.Net2.d
RadSpell.NET2.dll
RadTabStrip.Net2.d
RadToolbar.Net2.dl
RadTreeView.Net2.d
RadUpload.Net2.dll
RadWindow.Net2.dll
Telerik.Web。 UI.dll(这是新的DLL)

问题是所有的命名空间和类都是从旧的DLL到新的(Telerik.Web.UI)相同。



这是我遇到的具体错误:

 编译错误

说明:在编译服务此请求所需的资源时发生错误。请查看以下具体错误详细信息,并适当修改源代码。

编译器错误消息:CS0433:类型Telerik.Charting.ChartSeries存在于'c:\Windows\Microsoft.NET\Framework64\v2.0.50727\Temporary ASP'中。 NET Files\root\c6516654\63e1c826\assembly\dl3\9aa96a66\00ba04b3_fd85c701\RadChart.Net2.DLL'和'c:\Windows\Microsoft.NET\Framework64\v2。 0.50727\Temporary ASP.NET Files\root\c6516654\63e1c826\assembly\dl3\8fdb0e6c\001aa55c_c4f9c901\Telerik.Web.UI.DLL'
我已经考虑使用新的DLL,但我不确定这将有助于这种情况。任何帮助将不胜感激。

解决方案

您可以使用extern别名(教程 reference )来区分它们。不用说,很明显地避免了你可以,但至少C#提供了一个方法:)


Specifically, we are trying to upgrade our telerik controls to the latest version. Unfortunately, the old DLL's are so old that many of the control properties have changed vastly so we've decided to upgrade only the telerik control that is giving us problems (the RadEditor control).

So the bin looks something like this:

RadChart.Net2.dll
RadEditor.Net2.dll (we want to get rid on only this one)
RadGrid.Net2.dll
RadInput.Net2.dll
RadPanelbar.Net2.d
RadSpell.NET2.dll
RadTabStrip.Net2.d
RadToolbar.Net2.dl
RadTreeView.Net2.d
RadUpload.Net2.dll
RadWindow.Net2.dll
Telerik.Web.UI.dll (this is the new DLL)

The problem is that all the namespaces and classes are the same from the old DLLs to the new one (Telerik.Web.UI).

Here is the specific error I am getting:

Compilation Error

Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately. 

Compiler Error Message: CS0433: The type 'Telerik.Charting.ChartSeries' exists in both 'c:\Windows\Microsoft.NET\Framework64\v2.0.50727\Temporary ASP.NET Files\root\c6516654\63e1c826\assembly\dl3\9aa96a66\00ba04b3_fd85c701\RadChart.Net2.DLL' and 'c:\Windows\Microsoft.NET\Framework64\v2.0.50727\Temporary ASP.NET Files\root\c6516654\63e1c826\assembly\dl3\8fdb0e6c\001aa55c_c4f9c901\Telerik.Web.UI.DLL'

I've considered GAC-ing the new DLL but I am uncertain that this will help the situation. Any help would be greatly appreciated.

解决方案

You can use extern aliases (tutorial and reference) to differentiate between them. It's pretty annoying to have to, admittedly - obviously avoid where you can, but at least C# provides a way round it :)

这篇关于如何允许同一个命名空间的两个DLL存在于同一个应用程序中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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