简体   繁体   English

修复不安装VS Redistributables的MFC应用程序中的并行配置错误

[英]Fix side-by-side configuration error in MFC application w/o installing VS Redistributables

I'm making a very small MFC application TestEnumProcs.exe that does not come with many dependencies. 我正在制作一个很小的MFC应用程序TestEnumProcs.exe ,它没有很多依赖项。 Here's the screenshot from "Dependency Walker": 这是“ Dependency Walker”的屏幕截图:

在此处输入图片说明

I obtained Microsoft's MFC redistributable files mfc90u.dll and msvcr90.dll and placed them into the same folder as my TestEnumProcs.exe , but when I try to run it on one of my older computers I get this error: 我获得了Microsoft的MFC可再发行文件mfc90u.dllmsvcr90.dll ,并将它们放置在与TestEnumProcs.exe相同的文件夹中,但是当我尝试在其中一台较旧的计算机上运行它时,出现此错误:

在此处输入图片说明

The application has failed to start because its side-by-side configuration is incorrect... 该应用程序无法启动,因为其并行配置不正确...

The Event Log gave me three error messages like this: 事件日志给了我三个错误消息,如下所示:

Activation context generation failed for "J:\\TestEnumProcs.exe". “ J:\\ TestEnumProcs.exe”的激活上下文生成失败。 Dependent Assembly Microsoft.VC90.MFC,processorArchitecture="x86",publicKeyToken="1fc8b3b9a1e18e3b",type="win32",version="9.0.21022.8" could not be found. 找不到从属程序Microsoft.VC90.MFC,processorArchitecture =“ x86”,publicKeyToken =“ 1fc8b3b9a1e18e3b”,type =“ win32”,version =“ 9.0.21022.8”。 Please use sxstrace.exe for detailed diagnosis. 请使用sxstrace.exe进行详细诊断。

I then tried running the trace with sxstrace.exe and next is the outcome it gave me: 然后,我尝试使用sxstrace.exe运行跟踪,然后sxstrace.exe的结果是:

=================
Begin Activation Context Generation.
Input Parameter:
    Flags = 0
    ProcessorArchitecture = x86
    CultureFallBacks = en-US;en
    ManifestPath = J:\TestEnumProcs.exe
    AssemblyDirectory = J:\
    Application Config File = 
-----------------
INFO: Parsing Manifest File J:\TestEnumProcs.exe.
    INFO: Manifest Definition Identity is (null).
    INFO: Reference: Microsoft.VC90.CRT,processorArchitecture="x86",publicKeyToken="1fc8b3b9a1e18e3b",type="win32",version="9.0.21022.8"
    INFO: Reference: Microsoft.VC90.MFC,processorArchitecture="x86",publicKeyToken="1fc8b3b9a1e18e3b",type="win32",version="9.0.21022.8"
INFO: Resolving reference Microsoft.VC90.CRT,processorArchitecture="x86",publicKeyToken="1fc8b3b9a1e18e3b",type="win32",version="9.0.21022.8".
    INFO: Resolving reference for ProcessorArchitecture x86.
        INFO: Resolving reference for culture Neutral.
            INFO: Applying Binding Policy.
                INFO: Find publisher policy at C:\Windows\WinSxS\manifests\x86_policy.9.0.microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.30729.4926_none_f47c47b2f658b4a8.manifest
                INFO: Publisher Policy redirected assembly version.
                INFO: Post policy assembly identity is Microsoft.VC90.CRT,processorArchitecture="x86",publicKeyToken="1fc8b3b9a1e18e3b",type="win32",version="9.0.30729.4926".
            INFO: Begin assembly probing.
                INFO: Attempt to probe manifest at C:\Windows\WinSxS\manifests\x86_microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.30729.4926_none_508ed732bcbc0e5a.manifest.
                INFO: Manifest found at C:\Windows\WinSxS\manifests\x86_microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.30729.4926_none_508ed732bcbc0e5a.manifest.
            INFO: End assembly probing.
INFO: Resolving reference Microsoft.VC90.CRT.mui,language="*",processorArchitecture="x86",publicKeyToken="1fc8b3b9a1e18e3b",type="win32",version="9.0.30729.4926".
    INFO: Resolving reference for ProcessorArchitecture x86.
        INFO: Resolving reference for culture en-US.
            INFO: Applying Binding Policy.
                INFO: No publisher policy found.
                INFO: No binding policy redirect found.
            INFO: Begin assembly probing.
                INFO: Did not find the assembly in WinSxS.
                INFO: Attempt to probe manifest at C:\Windows\assembly\GAC_32\Microsoft.VC90.CRT.mui\9.0.30729.4926_en-US_1fc8b3b9a1e18e3b\Microsoft.VC90.CRT.mui.DLL.
                INFO: Did not find manifest for culture en-US.
            INFO: End assembly probing.
        INFO: Resolving reference for culture en.
            INFO: Applying Binding Policy.
                INFO: No publisher policy found.
                INFO: No binding policy redirect found.
            INFO: Begin assembly probing.
                INFO: Did not find the assembly in WinSxS.
                INFO: Attempt to probe manifest at C:\Windows\assembly\GAC_32\Microsoft.VC90.CRT.mui\9.0.30729.4926_en_1fc8b3b9a1e18e3b\Microsoft.VC90.CRT.mui.DLL.
                INFO: Did not find manifest for culture en.
            INFO: End assembly probing.
INFO: Resolving reference Microsoft.VC90.MFC,processorArchitecture="x86",publicKeyToken="1fc8b3b9a1e18e3b",type="win32",version="9.0.21022.8".
    INFO: Resolving reference for ProcessorArchitecture x86.
        INFO: Resolving reference for culture Neutral.
            INFO: Applying Binding Policy.
                INFO: No publisher policy found.
                INFO: No binding policy redirect found.
            INFO: Begin assembly probing.
                INFO: Did not find the assembly in WinSxS.
                INFO: Attempt to probe manifest at C:\Windows\assembly\GAC_32\Microsoft.VC90.MFC\9.0.21022.8__1fc8b3b9a1e18e3b\Microsoft.VC90.MFC.DLL.
                INFO: Attempt to probe manifest at J:\Microsoft.VC90.MFC.DLL.
                INFO: Attempt to probe manifest at J:\Microsoft.VC90.MFC.MANIFEST.
                INFO: Attempt to probe manifest at J:\Microsoft.VC90.MFC\Microsoft.VC90.MFC.DLL.
                INFO: Attempt to probe manifest at J:\Microsoft.VC90.MFC\Microsoft.VC90.MFC.MANIFEST.
                INFO: Did not find manifest for culture Neutral.
            INFO: End assembly probing.
    ERROR: Cannot resolve reference Microsoft.VC90.MFC,processorArchitecture="x86",publicKeyToken="1fc8b3b9a1e18e3b",type="win32",version="9.0.21022.8".
ERROR: Activation Context generation failed.
End Activation Context Generation.

=================
Begin Activation Context Generation.
Input Parameter:
    Flags = 0
    ProcessorArchitecture = x86
    CultureFallBacks = en-US;en
    ManifestPath = J:\TestEnumProcs.exe
    AssemblyDirectory = J:\
    Application Config File = 
-----------------
INFO: Parsing Manifest File J:\TestEnumProcs.exe.
    INFO: Manifest Definition Identity is (null).
    INFO: Reference: Microsoft.VC90.CRT,processorArchitecture="x86",publicKeyToken="1fc8b3b9a1e18e3b",type="win32",version="9.0.21022.8"
    INFO: Reference: Microsoft.VC90.MFC,processorArchitecture="x86",publicKeyToken="1fc8b3b9a1e18e3b",type="win32",version="9.0.21022.8"
INFO: Resolving reference Microsoft.VC90.CRT,processorArchitecture="x86",publicKeyToken="1fc8b3b9a1e18e3b",type="win32",version="9.0.21022.8".
    INFO: Resolving reference for ProcessorArchitecture x86.
        INFO: Resolving reference for culture Neutral.
            INFO: Applying Binding Policy.
                INFO: Find publisher policy at C:\Windows\WinSxS\manifests\x86_policy.9.0.microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.30729.4926_none_f47c47b2f658b4a8.manifest
                INFO: Publisher Policy redirected assembly version.
                INFO: Post policy assembly identity is Microsoft.VC90.CRT,processorArchitecture="x86",publicKeyToken="1fc8b3b9a1e18e3b",type="win32",version="9.0.30729.4926".
            INFO: Begin assembly probing.
                INFO: Attempt to probe manifest at C:\Windows\WinSxS\manifests\x86_microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.30729.4926_none_508ed732bcbc0e5a.manifest.
                INFO: Manifest found at C:\Windows\WinSxS\manifests\x86_microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.30729.4926_none_508ed732bcbc0e5a.manifest.
            INFO: End assembly probing.
INFO: Resolving reference Microsoft.VC90.CRT.mui,language="*",processorArchitecture="x86",publicKeyToken="1fc8b3b9a1e18e3b",type="win32",version="9.0.30729.4926".
    INFO: Resolving reference for ProcessorArchitecture x86.
        INFO: Resolving reference for culture en-US.
            INFO: Applying Binding Policy.
                INFO: No publisher policy found.
                INFO: No binding policy redirect found.
            INFO: Begin assembly probing.
                INFO: Did not find the assembly in WinSxS.
                INFO: Attempt to probe manifest at C:\Windows\assembly\GAC_32\Microsoft.VC90.CRT.mui\9.0.30729.4926_en-US_1fc8b3b9a1e18e3b\Microsoft.VC90.CRT.mui.DLL.
                INFO: Did not find manifest for culture en-US.
            INFO: End assembly probing.
        INFO: Resolving reference for culture en.
            INFO: Applying Binding Policy.
                INFO: No publisher policy found.
                INFO: No binding policy redirect found.
            INFO: Begin assembly probing.
                INFO: Did not find the assembly in WinSxS.
                INFO: Attempt to probe manifest at C:\Windows\assembly\GAC_32\Microsoft.VC90.CRT.mui\9.0.30729.4926_en_1fc8b3b9a1e18e3b\Microsoft.VC90.CRT.mui.DLL.
                INFO: Did not find manifest for culture en.
            INFO: End assembly probing.
INFO: Resolving reference Microsoft.VC90.MFC,processorArchitecture="x86",publicKeyToken="1fc8b3b9a1e18e3b",type="win32",version="9.0.21022.8".
    INFO: Resolving reference for ProcessorArchitecture x86.
        INFO: Resolving reference for culture Neutral.
            INFO: Applying Binding Policy.
                INFO: No publisher policy found.
                INFO: No binding policy redirect found.
            INFO: Begin assembly probing.
                INFO: Did not find the assembly in WinSxS.
                INFO: Attempt to probe manifest at C:\Windows\assembly\GAC_32\Microsoft.VC90.MFC\9.0.21022.8__1fc8b3b9a1e18e3b\Microsoft.VC90.MFC.DLL.
                INFO: Attempt to probe manifest at J:\Microsoft.VC90.MFC.DLL.
                INFO: Attempt to probe manifest at J:\Microsoft.VC90.MFC.MANIFEST.
                INFO: Attempt to probe manifest at J:\Microsoft.VC90.MFC\Microsoft.VC90.MFC.DLL.
                INFO: Attempt to probe manifest at J:\Microsoft.VC90.MFC\Microsoft.VC90.MFC.MANIFEST.
                INFO: Did not find manifest for culture Neutral.
            INFO: End assembly probing.
    ERROR: Cannot resolve reference Microsoft.VC90.MFC,processorArchitecture="x86",publicKeyToken="1fc8b3b9a1e18e3b",type="win32",version="9.0.21022.8".
ERROR: Activation Context generation failed.
End Activation Context Generation.

I know that this issue can be fixed by installing the " MFC Redistributable Package " on that system, but I would really like to avoid that and try to fix this issue by adding the missing DLLs. 我知道可以通过在该系统上安装“ MFC Redistributable Package ”来解决此问题,但我真的很想避免这种情况,并尝试通过添加缺少的DLL来解决此问题。

Any idea how to do that? 任何想法如何做到这一点?

I wrote an article about this for VS-2005 on Codeproject . 我在Codeproject上针对VS-2005撰写了有关此文章。

You can find the code for VS-2008 on my blog . 您可以在我的博客上找到VS-2008的代码。 It is German, but you only need the include file. 它是德语,但只需要包含文件。 The rest and the explanation can be found in the CodeProject article. 其余内容和说明可在CodeProject文章中找到。

With the include file, you don't have to change the manifests manually. 使用包含文件,您不必手动更改清单。 It is all done just by using the include files and set some defines. 只需使用include文件并设置一些定义即可完成所有操作。

The trace shows that msvcr90.dll is present in the side-by-side cache but mfc90u.dll is not. 跟踪显示并行缓存中存在msvcr90.dll,但mfc90u.dll不存在。 Fairly unusual, smells like another installer was run on that machine before that only deployed with it needed. 完全不寻常,闻起来像是在该机器上只需要部署它之前就在该机器上运行了另一个安装程序。

Local deployment is technically possible, it requires surgery on the manifests. 从技术上讲,本地部署是可能的,需要对清单进行手术。 You cannot remove them completely, there's a check built into the CRT that verifies that they are present and the app will fail with R6034 if they are not. 您无法将其完全删除,CRT内置有一个检查以验证它们是否存在,如果不存在,则该应用程序将失败并显示R6034。

The surgery changes the manifests to switch from side-by-side to private assemblies. 手术会将清单更改为从并排切换到私人装配。 Which requires that the "publicKeyToken" element is removed from the manifest entries. 这要求从清单条目中删除“ publicKeyToken”元素。 The private copy of the DLLs must also be copied into directories with the correct names and a tweaked manifest. DLL的私有副本也必须复制到具有正确名称和经过调整的清单的目录中。 The steps are outlined in this blog post . 本博客文章中概述了这些步骤。

Just running the vcredist installer is obviously much simpler and less error prone. 显然,仅运行vcredist安装程序更加简单,而且不容易出错。

See if you can convince the linker to spit out a list of library and DLL dependencies at build time. 查看您是否可以说服链接器在构建时吐出库和DLL依赖项列表。 Then you hunt them down from your dev machine and statically include them. 然后,从您的开发机上搜寻它们并静态地包含它们。 Kind of a pain. 有点痛苦。

In my quick glance over the linker command line arguments, here are a few that I would dig into: 我快速浏览了链接器命令行参数,下面是一些我要研究的内容:

I expect you should be able to see exactly what the dependencies are if you dig. 我希望您在挖掘时应该能够准确看到依赖项。

For what it's worth, the equivalent command line argument for the compiler is /showIncludes , 就其价值而言, 编译器的等效命令行参数为/showIncludes

Solved in 2017 by installing: Microsoft Visual C++ 2010 SP1 Redistributable Package (x86) 已在2017年通过安装以下解决方案:Microsoft Visual C ++ 2010 SP1可再发行组件包(x86)

https://www.microsoft.com/en-us/download/details.aspx?id=8328 https://www.microsoft.com/zh-cn/download/details.aspx?id=8328

Windows 10 and PCs with Visual Studio will need this fix. Windows 10和装有Visual Studio的PC将需要此修复程序。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 并排配置不正确 - Side-by-Side Configuration is incorrect 错误:“由于并排配置不正确,应用程序无法启动” - Error: “Application has failed to start because its side-by-side configuration is incorrect” “应用程序配置不正确”和“并行配置不正确”运行VS2008 64位调试版本 - “application configuration is incorrect” and “side-by-side configuration is incorrect” running VS2008 64-bit debug build 为什么我的 VS2010 原生 C++ 应用程序突然启动不了,出现并排错误? - Why won't my VS2010 native C++ application suddenly start, giving a side-by-side error? 该应用程序无法启动,因为其并行配置不正确 - The application has failed to start because its side-by-side configuration is incorrect C#Dll导入失败:“应用程序无法启动,因为它的并行配置不正确” - C# Dll Import failure: “The application has failed to start because its side-by-side configuration is incorrect” 如何解决导入期间 Viual Studio 中的并行配置错误 dll - How to solve side-by-side configuration error in Viual Studio during import dll 由于不正确的清单,并排配置不正确 - Side-by-Side configuration incorrect due to incorrect manifest 在一个应用程序中并排使用多个Internet Explorer版本 - Multiple Internet Explorer versions side-by-side in one application LoadLibraryEx忽略并排清单 - LoadLibraryEx ignores side-by-side manifest
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM