更新GAC dll [英] Updating GAC dlls

查看:78
本文介绍了更新GAC dll的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在GAC中注册了一个DLL,其中包含一个错误(v4.2.0).

I got a DLL registered in the GAC which has a bug in it (v4.2.0).

因此,我已修复了该错误,仅更新了文件版本(v4.2.1)(保留了程序集版本v4.2.0)并构建了新的MSI软件包.

I've therefore fixed that bug, updated the file version only (v4.2.1) (keeping the assembly version, v4.2.0) and built a new MSI package.

问题是GAC中未安装DLL.我通过右键单击 C:\ Windows \ Microsoft.NET \ assembly \ GAC_MSIL \ MyDLL \ v4.0_4.2.0.0__2269313d92725976 中的DLL进行了验证,并检查了文件版本,该版本仍然 v4.2.0 C:\ Windows \ Microsoft.NET \ assembly \ GAC_MSIL \ MyDLL 下也没有创建其他文件夹.

The problem is that the DLL is not installed in the GAC. I verified this by right-clicking on the DLL in C:\Windows\Microsoft.NET\assembly\GAC_MSIL\MyDLL\v4.0_4.2.0.0__2269313d92725976 and checked the file version, which is still v4.2.0 There are also no other folders created under C:\Windows\Microsoft.NET\assembly\GAC_MSIL\MyDLL.

但是!!如果我先卸载第一个版本,然后安装新的DLL,则可以在GAC中安装成功.

But! If I uninstall the first version and then install the new DLL it get's installed OK in the GAC.

我以错误的方式走这条路吗?我们的应用程序设置为使用特定版本,因此仅创建程序集版本v4.3.0并将其安装在GAC中是行不通的.

Am I approaching this the wrong way? Our applications are set to use specific versions, so just creating assembly version v4.3.0 and install it in the GAC wont work.

更新

我已经找到了有关发布者策略的文章( http://support.microsoft.com/kb/891030 ),并尝试进行该操作.我已经生成了策略程序集.但是当我尝试将它添加到安装项目=(

I've found the article about publisher policies ( http://support.microsoft.com/kb/891030) and are attempting that instead. I've generated the policy assembly. But Visual Studio crashes when I try to add it to the setup project =(

我还尝试将其作为内容文件添加到主项目中(然后将内容文件添加到GAC中).但是随后它抱怨程序集未签名.

I've also tried to add it as a content file to the primary project (and then add content files to GAC). But then it complains on the assembly not being signed.

所以我仍然被困住.

推荐答案

更新[AssemblyFileVersion]进行错误修复通常是正确的方法,尽管如果您在GAC中对程序集进行修改则会很麻烦.您冒着破坏另一个也使用该程序集的应用程序的风险,并且无意中依赖于越野车的行为来正常运行.重命名公共方法之类的无意错误当然始终是破坏应用程序的一种好方法,通往DLL Hell的道路上铺满了很多好意,但结果却很糟糕.

Updating the [AssemblyFileVersion] for a bug fix is usually the right approach, although it gets iffy if you do so for an assembly in the GAC. You run the risk of breaking another app that also uses the assembly and unintentionally depends on the buggy behavior to function correctly. An unintentional mistake like renaming a public method is of course always a good way to break an app, the road to DLL Hell is paved with many good intentions that turned out bad.

但是,GAC仅关注[AssemblyVersion],而忽略文件版本.要获取更新的部件以替换现有的部件,您必须先删除旧的部件.这是有意的,可防止意外更换.

The GAC however only pays attention to [AssemblyVersion] and ignores the file version. To get the updated assembly to replace the existing one you do have to remove the old one first. This is intentional, preventing accidental replacement.

要修复的应用程序的.config文件中的< bindingRedirect> 比发布商政策要容易得多.

A <bindingRedirect> in the .config file of the app you want to repair will be a lot easier to get going than a publisher policy.

这篇关于更新GAC dll的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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