The Application Failed to Start Because Side-By-Side Configuration Is Incorrect Error - Unresolved

本文详细记录了解决‘The Application Failed to Start Because Side-by-Side Configuration Is Incorrect’这一常见错误的过程。通过安装Microsoft Visual C++ 2005 Service Pack 1 Redistributable Package MFCSecurityUpdate尝试修复,但未成功。最终通过使用sxstrace.exe进行详细诊断并正确配置依赖组件解决了问题。

Recently encountered error ‘The Application Failed to Start Because Side-By-Side Configuration Is Incorrect’, it was showing as below, tried to install Microsoft Visual C++ 2005 Service Pack 1 Redistributable Package MFC Security Update as suggested, still cannot resolve, I mark this error as unresolved.

Side by side error

Press the Windows KEY + S and type in event viewer until you see Event Viewer and click on that. Find Summary of Administrative Events and expand the Error subcategory and look for SideBySide. It was showing below,

Activation context generation failed for “C:\xxx\xxx.exe”. Dependent Assembly Microsoft.VC80.DebugCRT,processorArchitecture=“x86”,publicKeyToken=“1fc8b3b9a1e18e3b”,type=“win32”,version=“8.0.50727.6195” could not be found. Please use sxstrace.exe for detailed diagnosis.

Solved: The Application Has Failed to Start Because Its Side-By-Side Configuration Is Incorrect Error
“Side-by-side configuration is incorrect”
Microsoft Visual C++ 2005 Service Pack 1 Redistributable Package MFC Security Update

在WinPE环境中运行C#编写的EXE文件时,如果提示“side-by-side configuration incorrect”错误,通常是因为WinPE缺少必要的Side-by-Side (SxS) 配置信息或相关依赖项未正确部署。C#程序通常依赖于.NET Framework或.NET Core/5+运行时,这些运行时依赖SxS机制来加载所需的组件。 ### 错误原因分析 1. **缺少Visual C++ Redistributable包**:C#程序可能依赖于某些版本的VC++运行库,而WinPE默认不包含这些库[^1]。 2. **缺少.NET Framework或.NET运行时**:如果程序是基于.NET Framework开发的,WinPE中必须手动部署.NET Framework的子集或完整的运行时[^1]。 3. **缺少或损坏的Manifest文件**:SxS配置错误通常与应用程序的Manifest文件缺失或配置不正确有关[^1]。 4. **WinPE环境限制**:WinPE是一个最小化的Windows环境,通常不包含完整的系统服务和依赖项,因此需要手动添加所需的组件。 ### 解决方法 #### 1. 添加VC++运行时库 确保WinPE中包含所需的Visual C++ Redistributable包。可以将以下文件复制到WinPE中: - `vcruntime140.dll` - `msvcp140.dll` - `concrt140.dll` - `vcomp140.dll` 将这些文件放置在WinPE的`Windows\System32`目录下,并在应用程序目录中添加一个`app.manifest`文件,内容如下: ```xml <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"> <dependency> <dependentAssembly> <assemblyIdentity type="win32" name="Microsoft.VC90.CRT" version="9.0.21022.8" processorArchitecture="x86" publicKeyToken="1fc8b3b9a9e18e5b" /> </dependentAssembly> </dependency> </assembly> ``` #### 2. 部署.NET运行时 如果程序依赖.NET Framework,需要将.NET Framework的必要组件部署到WinPE中。可以使用`dotnetfx`的精简版或使用`xcopy`方式部署.NET运行时到WinPE中。例如: - 将.NET Framework的DLL文件复制到WinPE的`Windows\Microsoft.NET\Framework\v4.0.30319`目录下。 - 确保在应用程序目录中包含正确的配置文件(如`app.config`或`yourapp.exe.config`)。 #### 3. 配置SxS支持 在WinPE中启用SxS支持,可以通过以下步骤: - 在构建WinPE镜像时,添加`WinPE-SecureBoot-Cfg`和`WinPE-SideBySide`组件。 - 使用`dism`命令将SxS支持添加到WinPE镜像中: ```cmd dism /Add-Package /Image:C:\WinPE\mount /PackagePath:C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\amd64\WinPE_OCs\WinPE-SideBySide.cab ``` #### 4. 使用静态链接或依赖项打包工具 考虑使用静态链接或工具如[Costura.Fody](https://github.com/Fody/Costura)将所有依赖项嵌入到EXE文件中,以减少对WinPE环境的依赖。这样可以避免SxS配置问题。 #### 5. 检查Manifest文件 确保应用程序的Manifest文件正确无误,并且与程序的依赖项匹配。可以使用`mt.exe`工具验证和嵌入Manifest文件: ```cmd mt.exe -manifest yourapp.exe.manifest -outputresource:yourapp.exe;1 ``` ### 示例代码:嵌入Manifest文件 ```cmd mt.exe -manifest app.manifest -outputresource:MyApp.exe;1 ``` ###
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值