2009-07-02 59 views
2

我有一个项目,该项目包括预生成的DLL模块,内置在过去的一段时间内,使用Visual Studio 9Howto:多个版本的msvcrt9作为专用SxS程序集?

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

当我们部署EXE时,我们不想要求管理员访问权限,所以C-Runtime已经绑定到应用程序的根目录中。 The Dlls:MSVCRT90.DLL及其清单:Microsoft.VC90.CRT.manifest

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

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

在我们的开发PC上安装了两个版本的VS9 CRuntime的应用程序的作品。在我们第一次安装应用程序的“新鲜”PC上 - DLL无法加载。

现在,我可以做一些秘技 - 一个是将应用恢复到9.0.2 - 从原始源媒体中获取9.0.2 DLL。这是不理想的,因为9.0.3是优选的。 或者我努力尝试重建第三方库。

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

应用程序清单和程序集旨在拯救我们所有人免受这种垃圾。 必须可以编辑程序集清单文件,以便可以加载exe和dll。

回答

2

我从来没有尝试过,但我认为你可以通过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> 
+0

这是非常接近到什么香港专业教育学院一直在努力。 但是在哪里以及如何放置该XML? 我的应用程序有一个嵌入的.manifest文件,文档说bindingRedirections应该放在app.exe.config文件中。我创建了配置文件,将它放在我的应用程序文件夹中,但没有看到任何区别。我不知道它甚至被使用。 也许我需要确保assemblyIdentity完全匹配我的应用程序清单assemblyIdentiy。 – 2009-07-03 12:20:31

相关问题