WinSxS fails to load VC++ DLLs
Asked Answered
B

1

10

I've got a problem with several VC++ DLLs, which I should include into my .NET/C# project. One VC++ DLL is a C++/CLI DLL, which I use as public interface from my .NET project. The other DLLs are written in native C++. I have no access to the source of the VC++ DLLs, I just have to use them.

I've made a .NET test project and referenced the C++/CLI DLL. No problem, compiler is lucky, great. There's just one problem: when I start the EXE of the .NET program, I get errors about the C++ DLLs because of missing VC++ core DLLs. sxstrace shows the following (shortened):

INFO: Reference: Microsoft.VC80.CRT,processorArchitecture="x86",publicKeyToken="1fc8b3b9a1e18e3b",type="win32",version="8.0.50727.6195"
INFO: Reference: Microsoft.VC80.OpenMP,processorArchitecture="x86",publicKeyToken="1fc8b3b9a1e18e3b",type="win32",version="8.0.50727.6195"
INFO: Resolving reference Microsoft.VC80.CRT,processorArchitecture="x86",publicKeyToken="1fc8b3b9a1e18e3b",type="win32",version="8.0.50727.6195"
...
ERROR: Cannot resolve reference Microsoft.VC80.CRT,processorArchitecture="x86",publicKeyToken="1fc8b3b9a1e18e3b",type="win32",version="8.0.50727.6195".

Now I'm no fool and tried several things. I've read much about WinSxS to get a deeper understanding about what's going on. Now I'm at the point, where it's getting weired for me. The system where I want to execute the program has the VC++ Redistributable package in the current version 8.0.50727.762 (SP1) installed. I know that there's a policy file for Microsoft.VC80.CRT in winsxs that redirects all versions of this assembly to the current version 8.0.50727.762 (that's the solution for the problem at http://blogs.msdn.com/b/nikolad/archive/2007/03/29/a-solution-to-two-references-to-different-versions-of-crt-mfc-atl-in-one-application-manifest-file.aspx). But as the error above says, this policy file doesn't seem to work or isn't taken into account. The system just wants to find the 8.0.50727.6195 version of the assembly.

Now that's the first question: what's the problem here? After I got this figured out, I could solve the initial problem...

Burgage answered 2/2, 2012 at 9:50 Comment(4)
The version mismatch is crystal clear in the message. It wants 8.0.50727.6195, you've got 8.0.50727.762. Go to search.microsoft.com and put "8.0.50727.6195" in the search box.Refection
The question is whether it is possible to "persuade" the application to accept 762 instead of 6195.Passim
I'm unsure about the versioning by Microsoft in this case. I didn't find a VC++ 2005 Redist Package with version 8.0.50727.6195 at Microsoft Download, the current VC++ 2005 Redist package comes in version 8.0.50727.762. If 762 is by version higher than 6195, it should be as I've written: the WinSxS policy file should redirect 6195 to 762 - but it doesn't.Burgage
Ok, perhaps I'm a fool, yet. By another article I found the link to the "Microsoft Visual C++ 2005 Service Pack 1 Redistributable Package MFC Security Update" - a.k.a. version 6195. Now I just got the problem that some delivered C++ DLLs have been compiled in Debug mode and depend on the Debug VC++ DLLs. I'm asking the other developers to give me the Release version, I hope that will work. I'll give you an update on this. Thanks!Burgage
B
9

Ok, now it works - thanks for your help.

I figured out two problems that had to be solved:

1) I had to install the "Microsoft Visual C++ 2005 Service Pack 1 Redistributable Package MFC Security Update", which deploys version 8.0.50727.6195 of the VC++ assemblies. This update was hard to find at the Microsoft servers, so here's the link: http://www.microsoft.com/download/en/details.aspx?id=26347 Normally you only find the 8.0.50727.762 version ("Visual C++ 2005 Service Pack 1 Redistributable Package), which is outdated. Since the C++ DLLs were compiled against 6195, installing the update solved the first problem.

2) While the C++/CLI DLL was compiled in Release mode, the native C++ DLLs below had been delivered in Debug mode. Now the Microsoft license agreement prohibits deploying the VC++ Debug DLLs and the VC++ Redist Packages don't include the VC++ Debug DLLs. http://msdn.microsoft.com/en-us/library/aa985618.aspx says:

Debug versions of an application are not redistributable and none of the debug versions of the various Visual C++ dynamic-link libraries (DLLs) are redistributable.

Solution: the developers of the native C++ DLLs gave me a release version and everything works fine...

Burgage answered 6/2, 2012 at 8:59 Comment(1)
Note for future generations: Step 1) solved my "The application has failed to start because its side-by-side configuration is incorrect" error unrelated to the original question. Might work for others as well, when other suggestions fail.Cupric

© 2022 - 2024 — McMap. All rights reserved.