如果我在 GAC 中有两个同名的程序集,我如何告诉 .Net 使用哪个?
我在全局程序集缓存中有两个同名的程序集,但版本号不同。 如何告诉我的程序要引用哪个版本?
根据记录,这是 ASP.Net 网站中的 VB.Net 页面。
I have two assemblies with the same name in the Global Assembly cache, but with different version numbers. How do I tell my program which version to reference?
For the record, this is a VB.Net page in an ASP.Net web site.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
将程序集添加到配置文件的 程序集 部分下并包含版本号。
add 元素添加在动态资源编译期间使用的程序集引用。 编译每个代码模块时,ASP.NET 会自动将此程序集链接到资源。
Add the assembly to the config file under the assemblies section with version number.
The add element adds an assembly reference to use during compilation of a dynamic resource. ASP.NET automatically links this assembly to the resource when compiling each code module.
只要版本号不同(这是必需的),您就可以通过 web.config 文件指定正确的版本。 这就是我在我的一个应用程序中进行设置以引用正确版本的 Crystal Reports 的方式,因为我们在 GAC 中有多个版本:
As long as the version number is different (which would be required), you can specify the proper version through your web.config file. This is how I have things setup in one of my apps to reference the proper version of Crystal Reports, since we have multiple versions in the GAC:
当您在配置文件中添加对 DLL 的引用时,您可以指定版本以及强名称:
或
When you add a reference to the DLL in your config file, you specify the version as well as the strong name:
or
要在 GAC 中安装程序集,您必须为其指定一个强名称。 强名字永远不会重复。 因此,要指定要使用哪个程序集,请通过强名称引用它。
To install an assembly in the GAC you have to give it a strong name. Strong names are never duplicated. So to specify which assembly you want to use you reference it by the strong name.