How to handle Side-by-Side Configuration Incorrect

Getting Started

Most of the developers using assemblies in their application may have faced this issue. While starting an application, we may get an error “This application has failed to start because its side by side configuration is incorrect”.

Introduction

Side by side configuration is a trick for versioning files, in which multiple versions of a file are installed in a single machine. This is achieved through manifest files. E.g.: the C Runtime Library assembly contains three DLLs—msvcr80.dll , msvcm80.dll and msvcp80.dll — and is used by applications when they are built using functions from the CRT library. Side-by-side technology is also known as WinSxS or SxS.

What is Side by Side Configuration?

A side-by-side assembly contains a collection of resources—a group of DLLs, Windows classes, COM servers, type libraries, or interfaces—that are always provided to applications together. These are described in the assembly manifest.

Why is it Important?

In many cases, it is possible to update existing applications to use side-by-side assemblies without having to change the application code. Developers are encouraged to use side-by-side assemblies to create isolated applications, and to update existing applications into isolated applications for the following reasons:

  • Side-by-side assemblies reduce the possibility of DLL version conflicts.
  • Side-by-side assembly sharing enables multiple versions of COM or Windows assemblies to run at the same time.
  • Applications and administrators can update assembly configuration on either a global or per-application configuration basis after deployment. For example, an application can be updated to use a side-by-side assembly that includes an update without having to reinstall the application.

How is it Working?

In the preceding example shown in above picture, both Comctl32.DLL version 6.0 and Comctl32.DLL version 5.0 are in the side-by-side assembly cache and available to applications. When an application calls to load the DLL, the side-by-side manager determines whether the application has a version dependence described in a manifest. If there is no relevant manifest, the system loads the default version of the assembly. For Windows XP, version 5.0 of Comctl32.DLL is the system default. If the side-by-side manager finds a dependence on version 6.0 stated in a manifest, that version is loaded to run with the application.

Is it Related Project Settings?

We have to check if it is possible to resolve with project settings because EXE will run in debug build and fails to start in release build. Change your project settings to not use the runtime library, but this will make the output EXE bigger. (Project Properties -> C/C++ -> Code Generation -> Runtime Library -> use/MT or /MTd depends on your current configuration.) This may work, but it is not the solution for this issue.

Is it OS Related?

No, it is not an OS related issue. Since most of the experiences for this issue are in Vista, initially I thought it is only in Vista machine. Side by side error will come irrespective of OS, if reference assembly is missing from Sxs folder.

What is the Solution?

Now we need to think about the solution for this. Since the error message itself is saying “Please check windows event viewer for further information”. Go to event viewer and check for entry with sidebyside. Here we will take an example:

"Activation context generation failed for “DataViewer.dll ". Dependent Assembly Microsoft.VC90.MFC, processorArchitecture="x86", publicKeyToken="1fc8b3b9a1e18e3b", type="win32", version="9.0.21022.8" could not be found. Please use sxstrace.exe for detailed diagnosis."

Here we are clear with what we are missing. We are missing 9.0.21022.8 version of Microsoft.VC90.MFC. You can go to C:/Windows/WinSxs folder and manually verify this dependent assembly is there or not. Since we are missing an assembly, the only solution is that reference assembly should be in the machine we are running our application on. Since we need to install dependent assembly to our client machine, we need to run Microsoft redistributable package for the required assembly to client machine. See section website for patches for downloading packages.

Are Sxstrace.exe Tools Useful?

This tool helps us for detailed diagnosis such as assembly probing steps. It also help us to identify what all are the previous versions available and loaded by the application and which folder it is currently searching for.

How Can I Use sxstrace.exe?

For running sxstrace.exe , go to Visual Studio command prompt and type sxstrace.exe . Usage is as follows:

  1. Before running your application, run sxstrace in trace mode sxstrace.exe Trace -logfile:C:/tmp/MySxSTrace.log
  2. Reproduce the error by starting your application
  3. Now stop the trace by using the below command sxstrace.exe Parse -logfile:C:/tmp/MySxSTrace.log -outfile:C:/tmp/MySxSTrace.txt
  4. Open output file from C:/tmp/MySxSTrace.txt

Website for Patches

Conclusion

Side by side configuration error comes because of the referenced assembly missing from winsxs folder. There is no code change for this issue, we can install the required patches to client machine and rebooting the PC will resolve this issue.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值