Howto:将 msvcrt9 的多个版本作为私有 SxS 程序集?

发布于 2024-07-26 04:43:33 字数 770 浏览 4 评论 0原文

我有一个包含预构建 Dll 模块的项目,该项目是在过去使用 Visual Studio 9 构建的。

该项目的 EXE 现在是使用 Visual Studio 9 SP1 构建的。

当我们部署 EXE 时,我们不希望需要管理访问权限,因此 C 运行时已捆绑到应用程序的根目录中。 Dll:MSVCRT90.DLL 及其清单:Microsoft.VC90.CRT.manifest

现在,EXE 和最新版本的运行时清单都一致 - 应用程序清单要求 msvcrt.dll 的版本为 9.0.30729.1,而 crt-清单包含确认 msvcrt90.dll 版本为 9.0.30729.1 的条目

现在,有一个问题。 我们的应用程序使用的第 3 方 DLL 库与原始 msvcrt90.dll 版本 9.0.21022.8 链接,并具有一个达到此效果的内部清单。

在我们安装了两个版本的 VS9 CRuntime 的开发 PC 上,该应用程序可以正常运行。 在我们第一次安装应用程序的“新”电脑上 - DLL 无法加载。

现在,我可以做一些作弊 - 一是将应用程序恢复到 9.0.2 - 从原始源媒体中获取 9.0.2 DLL。 这是不希望的,因为 9.0.3 更可取。 或者我非常努力地重建第 3 方库。

我还非常确定,在我们的开发 PC 上,当第 3 方库请求旧 dll 时,它会被重定向到新 dll - 它们是二进制兼容的。

应用程序清单和程序集旨在将我们所有人从此类垃圾中拯救出来。 必须可以编辑程序集清单文件,以便 exe 和 dll 都可以加载。

I have a project that comprises pre-build Dll modules, built some time in the past, using Visual Studio 9.

The EXE of the project is built now, using SP1 of Visual Studio 9.

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

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

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.

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.

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.

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.

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

煮茶煮酒煮时光 2024-08-02 04:43:33

我从来没有尝试过,但我认为你可以通过清单中的 BindingRedirect 来解决这个问题,我知道它在托管世界中有效。

请参阅示例(您需要更改您的版本的值)

<?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>

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.

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>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文