I have a native C ++ library with a .NET shell built into Visual Studio 2003 and 2005. We recently ported the .NET wrapper library to VS2005 and it does not work. The .NET wrapper library is a mixed mode, with native C ++ and Managed extensions classes and a bit of native assembly in places. Assume that in all cases, the release binary is used.
VS2003.NET dll works fine without any complaints, but so far I canβt go anywhere with VS2005. I have other native applications built into my native library, so the problem seems to be related to the linker settings and dynamic binding rules, especially to the .NET library.
The .net library uses managed extensions for C ++ (/ clr: oldSyntax), so some options are limited in the property sheet.
The initial problem that I encountered - runtime error R6034: An application has made an attempt to load the C runtime library incorrectly. This has been fixed by including the built-in manifest in the assembly. An Exception trace for this follows:
Unhandled Exception: System.IO.FileLoadException: A dynamic link library (DLL) initialization routine failed. (Exception from HRESULT: 0x8007045A)
at Corp.Blah.BlahConsole.Program.Main(String[] args)
After implementing the manifest in the assembly, I get a new error. A lateral error in the title of the question arises from Dependency Walker. Full text:
Error: The Side-by-Side configuration information for "s:\release\MDM3NET80.DLL" contains errors. This application has failed to start because the application configuration is incorrect. Reinstalling the application may fix this problem (14001).
Warning: At least one delay-load dependency module was not found.
Warning: At least one module has an unresolved import due to a missing export function in a delay-load dependent module.
As far as I can tell, download delay warnings relate to parts of Kernel32.dll that have been changed in different versions of Windows but not related to my application, in particular MPR.DLL, IESHIMS.DLL and WER.DLL. These warnings seem inconsequential.
Attempting to load a .NET DLL using a small console application creates System.IO.FileLoadException:
Unhandled Exception: System.IO.FileLoadException: Could not load file or assembly 'BLAH, Version=5.0.0.22, Culture=neutral, PublicKeyToken=ffbc9a05441709bc' or one of its dependencies. This application has failed to start because the application configuration is incorrect. Reinstalling the application may fix this problem. (Exception from HRESULT: 0x800736B1)
File name: 'BLAH, Version=5.0.0.22, Culture=neutral, PublicKeyToken=ffbc9a05441709bc'
at Corp.Blah.BlahConsole.Program.Main(String[] args)
, , , Visual Studio MSCRT.
DLL:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity name="Corp.Blah.BlahNet">
</assemblyIdentity>
<dependency>
<dependentAssembly>
<assemblyIdentity type="win32" name="Microsoft.VC80.CRT" version="8.0.50727.762" processorArchitecture="x86" publicKeyToken="1fc8b3b9a1e18e3b">
</assemblyIdentity>
</dependentAssembly>
</dependency>
</assembly>
DLL- CRT WINSxS x86_Microsoft.VC80.CRT_1fc8b3b9a1e18e3b_8.0.50727.762_x-ww_6b128700 . , , , .
, :
- . R6034, FileLoadException/side-by-side.
- Dll MSCRT .lib.
- /MD /MT ( /clr: oldSyntax, VS2003, ).
- β Linker β : ( ), - ( )
- .NET VS2010 VS2005 - .
, . - ? .
System Event Viewer : SideBySide, :
S:\release\BlahNet.dll. :.
Daily WTF.
:
VS2005 . , -, , . , FileLoadException DLL.