如何引用多个版本的组件 [英] How to reference to multiple version assembly

查看:232
本文介绍了如何引用多个版本的组件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个SharePoint应用程序,并使用.NET库AjaxControlToolkit中,我们添加了一个自定义的aspx页面到SharePoint。 SharePoint 2007中运行的怪癖模式,所以我做了一些修改的AJAX库,使其行为像它通常应。问题是,其他球队已经在使用AJAX库,这是一个不同的版本我的。这引起冲突,因为有可能是在具有相同名称的bin文件夹中只有一个DLL。

I'm developing a Sharepoint application and use .NET AjaxControlToolkit library, we are adding a custom aspx page to the Sharepoint. Sharepoint 2007 run in quirks mode so I've made some modification to the AJAX library to make it behave like it normally should. The problem is, the other team already use AJAX library and it is a different version with mine. This cause conflict because there could be only one dll in the bin folder with the same name.

据我所知,.NET应该能够很容易地处理这种情况。我用强名称和GAC解决它试了,但它仍然是指该dll在bin文件夹中。如果在bin文件夹中没有AjaxControlToolkit.dll,应用程序将简单地无法加载程序集。

From what I know, .NET should be able to handle this situation easily. I've tried using strong name and GAC to solve it, but it still refer to the dll in the bin folder. If there is no AjaxControlToolkit.dll in the bin folder, the application will simply fail to load the assembly.

如果我用完整的装配信息,对我这样的

If I use complete assembly information on my like this

<%@ 
Register
tagprefix="AjaxControlToolkit"
namespace="AjaxControlToolkit"
assembly="AjaxControlToolkit, Version=1.0.299.18064,
PublicKeyToken=12345678abcdefgh,
Culture=neutral"
%>

这给了我编译器错误CS0433

It gives me Compiler Error CS0433

有人可以帮助我了解如何使用多个版本的组件的应用程序?

Can someone help me on how to use multiple version of assembly in an application?

推荐答案

嘛链接的编译器错误CS0433 使得它pretty的明确,核心问题不在于有多个版本的组件被引用的 - 但与命名空间+类型名称冲突

Well the link for Compiler Error CS0433 makes it pretty clear that the core issue is not with multiple versions of the assembly being referenced - but with namespace + typename conflicts.

在加载/引用类型 - 编译器无法解析加载该类型从哪个DLL。如果已将SharePoint将同时加载您的dll版本(正如你所说的,它需要) - 这个错误会经常来

When you load up / reference a type - the compiler can't resolve which DLL to load that type from. If Sharepoint is going to load both your DLLs versions (as you say it needs to) - this error will always come.

简单的解决办法是改变了命名空间的新的DLL,因为它确实有自定义调整,你就控制了code - 纪念它显然还有

Simplest fix would be to change the namespaces in the new DLL, since it does have your custom tweaks, and you control the code - mark it clearly as well.

这篇关于如何引用多个版本的组件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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