我们有一个旧的C/C++ .dll是COM注册的.我们的客户拥有使用此.dll的本机和.NET客户端.
原文链接:https://www.f2er.com/windows/365148.html我们已经构建了一个新的.NET .dll来替换旧的.dll,它们的COM接口完全相同.我们希望在没有客户需要重新编译或对客户做任何事情的情况下更换旧的.dll.
对于本机客户端,只需取消注册旧的.dll并注册新的(使用regasm)即可.它也适用于某些.NET客户端.但是,在这些情况下,客户端和新的.dll都使用相同的.NET版本进行编译,它会引发下面的异常.
换句话说,这有效:
.dll is .NET 3.5 -> client is .NET 4.0 .dll is .NET 4.0 -> client is .NET 3.5 .dll is any .NET -> Client is native
这会抛出以下内容:
.dll is .NET 4.0 -> client is .NET 4.0 .dll is .NET 3.5 -> client is .NET 3.5
[A]BARAPIXLib.barcom5 cannot be cast to [B]BARAPIXLib.barcom5.
Type A originates from ‘BARAPIXLib,Version=1.0.0.0,Culture=neutral,PublicKeyToken=null’ in the context ‘LoadFrom’ at location C:\arkiv\S_BTW\BTW\BARAPIXWebService\Barapix\bin\BARAPIXLib.dll’.
Type B originates from ‘BartrackTest,PublicKeyToken=null’ in the context ‘Default’ at location ‘C:\arkiv\Bartrack\BartrackTest\x86\Src\BartrackTest\bin\x86\Release\BartrackTest.exe’.”}
任何想法,将不胜感激.