Assembly-Binding Error on shared Component

huangapple go评论45阅读模式
英文:

Assembly-Binding Error on shared Component

问题

我设置了一个我们的程序在客户机器上的结构之后,如下:

c:\Program Files (x86)\Common Files\company\DLL\LicenseServer\

  • LicenseServer.dll (V1.0)
  • Tools.dll (V1.0)

c:\Program Files (x86)\company\FancyProg1\

  • MyProg1.exe (.net)

MyProg1.exe使用来自公共文件夹的LicenseServer.dll,LicenseServer.dll本身引用了Tools.dll。在LicenseServer的引用中设置了"SpecificVersion=False"。
LicenseServer也通过Regasm /codebase注册为com服务器。

现在用户想要安装另一个程序,该程序也使用LicenseServer。

之后,我的文件夹看起来像这样:
c:\Program Files (x86)\Common Files\company\DLL\LicenseServer\

  • LicenseServer.dll (V1.0)
  • Tools.dll (V1.1)

c:\Program Files (x86)\company\FancyProg2\

  • MyProg2.exe (本地,C++)

MyProg2.exe的设置仍然包含LicenseServer.dll的V1.0版本,但Tools.dll已经升级到V1.1(增加了一些附加方法,但没有更改任何公共方法的定义)。MyProg2的LicenseServer是使用对Tools.dll V1.1的引用构建的(仍然使用"Specific Version=False"),但没有其他更改,因此仍然是V1.0。

在将MyProg2设置到目标计算机时,安装程序不会复制LicenseServer.dll,因为它与已安装的版本相同。但它会将Tools.dll从V1.0升级到V1.1。

然后,MyProg2无法引用LicenseServer。它不会加载Tools.dll,因为它仍然搜索V1.0版本。
请注意,MyProg2是一个本地C++程序,它将LicenseServer作为Com服务器使用。它通过Regasm /codebase注册。

那么问题是:如何使LicenseServer作为Com服务器工作,即使其中有更新的Tools.dll。

英文:

I have the folloing structure after setting up one of our programs on the customers machine:

c:\Program Files (x86)\Common Files\company\DLL\LicenseServer\

  • LicenseServer.dll (V1.0)
  • Tools.dll (V1.0)

c:\Program Files (x86)\company\FancyProg1\

  • MyProg1.exe (.net)

MyProg1.exe is using the LicenseServer.dll from the common files-folder which by itself has a reference to Tools.dll. The reference at the Licenserver was build with "SpecificVersion=False".
LicenseServer ist registered via Regasm /codebase for use as com-server as well

Now the user wants to setup another Program which also uses LicenseServer.

After that my Folders look like this
c:\Program Files (x86)\Common Files\company\DLL\LicenseServer\

  • LicenseServer.dll (V1.0)
  • Tools.dll (V1.1)

c:\Program Files (x86)\company\FancyProg2\

  • MyProg2.exe (native, c++)

It's setup contains LicenseServer.dll still in V1.0 but the Tools.dll has evolved to V1.1 (some additional Methods, but no change in any public methods definition).
The LicenseServer of MyProg2 was build with a Reference to Tools.dll V1.1 (still with "Specific Version=False") but has no other change so its still V1.0.

While setting MyProg2 on the target-machine the setup-Program does not Copy LicenseServer.dll because it has the same version that the one already installed. Yet it updates the Tools.dll from V1.0 to V1.1 because is brings a newer one.

Well, after that MyProg2 cannot reference LicenseServer. It won't load Tools.dll because it still searches for V1.0.
Notice that MyProg2 is a native-c++-program with uses LicenseServer as a Com-Server. Its registered via Regasm /codebase.

However, MyProg1 (the .net-program which loads LicenseServer as a regular .net-dll) works and uses the newer Tools.dll

So the question is: how to make LicenseServer as a Com-Server work, even when there is a newer Tolls.dll in it.

答案1

得分: -1

代码部分不要翻译。以下是翻译好的部分:

"The trick is not to version LicenseServer and all its references independently, but to give them all a new, same version number everytime Prog2 gets a new release. Even when there was noch change in the sources. This prevents only one component from being updated because it is newer. During setup, either all or no components are then replaced."

英文:

The trick is not to version LicenseServer and all its references independently, but to give them all a new, same version number everytime Prog2 gets a new release. Even when there was noch change in the sources. This prevents only one component from being updated because it is newer.
During setup, either all or no components are then replaced

huangapple
  • 本文由 发表于 2023年2月13日 23:51:35
  • 转载请务必保留本文链接:https://go.coder-hub.com/75438212.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定