I have a project that comprises pre-build Dll modules, built some time in the past, using Visual Studio 9.
我有一个包含预构建Dll模块的项目,使用Visual Studio 9构建过去一段时间。
The EXE of the project is built now, using SP1 of Visual Studio 9.
现在使用Visual Studio 9的SP1构建项目的EXE。
When we deploy the EXE we don't want to require administrative access, so the C-Runtime has been bundled into the root of the application. The Dlls: MSVCRT90.DLL and their Manifest: Microsoft.VC90.CRT.manifest
当我们部署EXE时,我们不希望需要管理访问权限,因此C-Runtime已捆绑到应用程序的根目录中。 Dlls:MSVCRT90.DLL及其清单:Microsoft.VC90.CRT.manifest
Now, the EXE and latest versions of the runtime manifests are all in agreement - the application manifest asks for 9.0.30729.1 of msvcrt.dll, and the crt-manifest contains the entries confirming that msvcrt90.dll is version 9.0.30729.1
现在,EXE和运行时清单的最新版本都是一致的 - 应用程序清单请求msvcrt.dll的9.0.30729.1,而crt-manifest包含确认msvcrt90.dll是版本9.0.30729.1的条目
Now, a problem. A 3rd party DLL library used by our application was linked against the original msvcrt90.dll version 9.0.21022.8 and has an internal manifest to this effect.
现在,一个问题。我们的应用程序使用的第三方DLL库与原始msvcrt90.dll版本9.0.21022.8链接,并具有此效果的内部清单。
On our development PCs where both versions of the VS9 CRuntime have been installed the app works. On "fresh" PCs where we install the app for the first time - the DLL fails to load.
在我们的开发PC上安装了两个版本的VS9 CRuntime,该应用程序可以运行。在我们第一次安装应用程序的“新鲜”PC上 - DLL无法加载。
Now, I have some cheats I can do - one is to revert the app to 9.0.2 - get the 9.0.2 DLLs off the original source media. This is undesirable as 9.0.3 is preferable. Or I try really hard to get a rebuild of the 3rd party library.
现在,我有一些我可以做的秘诀 - 一个是将应用程序还原为9.0.2 - 从原始源媒体获取9.0.2 DLL。这是不希望的,因为9.0.3是优选的。或者我非常努力地重建第三方图书馆。
I am furthermore pretty certain that, on our development PCs, when the 3rd party library asks for the old dll it gets redirected to the new dll - they are binary compatible.
我还非常肯定,在我们的开发PC上,当第三方库要求旧的dll时,它会被重定向到新的dll - 它们是二进制兼容的。
Application manifests and assemblies were meant to save us all from this kind of rubbish. It must be possible to edit the assembly manifest files so that both the exe and dll can load.
应用程序清单和程序集旨在使我们所有人免于这种垃圾。必须可以编辑程序集清单文件,以便exe和dll都可以加载。
1 个解决方案
#1
I've never tried that but I think you can solve that with bindingRedirect in the manifest, I know that it works in the managed world.
我从来没有尝试过,但我认为你可以通过manifest中的bindingRedirect解决这个问题,我知道它在托管世界中有效。
See example (You will need to change the values for your version)
查看示例(您需要更改版本的值)
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<configuration>
<windows>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<assemblyIdentity name="Your.Application.Name" type="win32" version="9.0.0.0"/>
<dependentAssembly>
<assemblyIdentity type="win32" name="Microsoft.VC90.CRT" processorArchitecture="x86" publicKeyToken="1fc8b3b9a1e18e3b" />
<bindingRedirect oldVersion="9.0.20718.0-9.0.21022.8" newVersion="9.0.30411.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity type="win32" name="Microsoft.VC90.MFC" processorArchitecture="x86" publicKeyToken="1fc8b3b9a1e18e3b" />
<bindingRedirect oldVersion="9.0.20718.0-9.0.21022.8" newVersion="9.0.30411.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity type="win32" name="Microsoft.VC90.MFCLOC" processorArchitecture="x86" publicKeyToken="1fc8b3b9a1e18e3b">
</assemblyIdentity>
<bindingRedirect oldVersion="9.0.20718.0-9.0.21022.8" newVersion="9.0.30411.0"/>
</dependentAssembly>
</assemblyBinding>
</windows>
</configuration>
#1
I've never tried that but I think you can solve that with bindingRedirect in the manifest, I know that it works in the managed world.
我从来没有尝试过,但我认为你可以通过manifest中的bindingRedirect解决这个问题,我知道它在托管世界中有效。
See example (You will need to change the values for your version)
查看示例(您需要更改版本的值)
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<configuration>
<windows>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<assemblyIdentity name="Your.Application.Name" type="win32" version="9.0.0.0"/>
<dependentAssembly>
<assemblyIdentity type="win32" name="Microsoft.VC90.CRT" processorArchitecture="x86" publicKeyToken="1fc8b3b9a1e18e3b" />
<bindingRedirect oldVersion="9.0.20718.0-9.0.21022.8" newVersion="9.0.30411.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity type="win32" name="Microsoft.VC90.MFC" processorArchitecture="x86" publicKeyToken="1fc8b3b9a1e18e3b" />
<bindingRedirect oldVersion="9.0.20718.0-9.0.21022.8" newVersion="9.0.30411.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity type="win32" name="Microsoft.VC90.MFCLOC" processorArchitecture="x86" publicKeyToken="1fc8b3b9a1e18e3b">
</assemblyIdentity>
<bindingRedirect oldVersion="9.0.20718.0-9.0.21022.8" newVersion="9.0.30411.0"/>
</dependentAssembly>
</assemblyBinding>
</windows>
</configuration>