如何允许两个具有相同命名空间.类的 DLL 存在于同一个应用程序中?

发布于 2024-07-27 21:08:41 字数 1234 浏览 3 评论 0原文

具体来说,我们正在尝试将 Telerik 控件升级到最新版本。 不幸的是,旧的 DLL 太旧了,许多控件属性都发生了巨大变化,因此我们决定仅升级给我们带来问题的 telerik 控件(RadEditor 控件)。

所以 bin 看起来像这样:

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)

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

以下是我收到的具体错误:

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'

我已考虑过 GAC 处理新的 DLL,但我不确定这是否会对这种情况有所帮助。 任何帮助将不胜感激。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

┼── 2024-08-03 21:08:41

您可以使用外部别名(教程参考)来区分它们。 诚然,不得不这样做是相当烦人的 - 显然要尽可能避免,但至少 C# 提供了一种解决方法:)

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 :)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文