本文介绍了如何执行链接到2个不同版本的MFC的应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,

我创建了一个应用程序,该应用程序与引用多个已交付运行时DLL的EXE一起构建了DLL.生成的DLL和EXE是使用VS2012构建的,而交付的运行时DLL是使用VS2010构建的.当我尝试执行应用程序时, 我将在WinMain中收到访问冲突(对AfxGetThread的调用返回NULL).只是为了验证应用程序,如果提供的运行时DLL也使用VS2012生成,则该应用程序将成功执行.

我的目标是不重新链接就执行应用程序.

有没有办法利用清单配置文件,使用VS2010(由运行时DLL制作)对VS2010的引用并将其更改为VS2012,以便可以在不重新链接的情况下执行应用程序?

这是我创建的配置文件,但未成功:

Hello,

I have created an application that builds a DLL along with an EXE that references several delivered runtime DLL's. The built DLL and EXE have been built with VS2012, and the delivered runtime DLL have been built with VS2010. When I attempt to execute the application, I will receive an access violation in WinMain (the call to AfxGetThread returns NULL). Just to verify the application, if the delivered runtime DLLs were also built with VS2012, the application executes successfully.

My goal is the execute the application without relinking it.

Is there a way to utilize a manifest config file, using and to change the references to VS2010 (made by the runtime DLLs) to VS2012 so that the application can be executed without relinking?

Here is the config file that I created, but was not successful:

<configuration>
   <windows>
      <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1" >
         <dependentAssembly>
            <assemblyIdentity type="win32" name="Microsoft.VC100.MFC" processorArchitecture="x86" publicKeyToken="1fc8b3b9a1e18e3b" />
            <bindingRedirect oldVersion="10.0.40219.325" newVersion="11.0.60610.1" />
            <assemblyIdentity type="win32" name="Microsoft.VC100.CRT" processorArchitecture="x86" publicKeyToken="1fc8b3b9a1e18e3b" />
            <bindingRedirect oldVersion="10.0.40219.325" newVersion="11.0.51106.1" />
         </dependentAssembly>
      </assemblyBinding>
   </windows>
</configuration>

我不确定程序集名称Microsoft.VS100.MFC和Microsoft.VS100.CRT是否真的有效,也不确定我是否可以在主要VS版本之间进行重定向.

我还没有找到任何可行的例子.任何帮助都会有所帮助.

此致Rob

I am not sure if assembly names Microsoft.VS100.MFC and Microsoft.VS100.CRT are actually valid, and also not sure if I can redirect between major VS releases.

I have not been able to find any working examples. Any assistance would be helpful.

Regards, Rob

推荐答案


是什么使您认为VS2012 EXE应该能够成功调用VS2010 DLL?通常,这是不可能的.


What makes you think that the VS2012 EXE should be able to successfully call into a VS2010 DLL? In general, this is not possible.


这篇关于如何执行链接到2个不同版本的MFC的应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-01 01:05