Just fixed an issue with our Zeta Producer 11 that occurs only on the brand new Windows 8. The German error message was:
Die Datei oder Assembly „ZetaHtmlTidy.dll“ oder eine Abhängigkeit davon wurde nicht gefunden. Eine DLL-Initialisierungsroutine ist fehlgeschlagen. (Ausnahme von HRESULT: 0x8007045A)
Translated to English it was:
System.IO.FileLoadException ‚A dynamic link library (DLL) initialization routine failed. (Exception from HRESULT: 0x8007045A)‘
The DLL in concern was a mixed Managed/Unmanaged C++ assembly that wrapped the popular HTML Tidy C sources into a .NET-usable assembly.
So my first idea was that some CRT DLLs were missing:
- msvcm90.dll
- msvcp90.dll
- msvcr90.dll
- Microsoft.VC90.CRT.manifest
But all were present, even the well-known Dependency Walker/Viewer did not help any further.
Since version 10 of our application worked and version 11 did not work and brought the above error, I was clueless. The main difference was:
- Version 10 was installed into „C:\Program Files (x86)\Zeta Producer 10“.
- Version 11 was installed into „C:\Users\YourName\AppData\Local\Zeta Producer 11″ (to bypass administrative setup permissions).
When I moved Version 10 also below the „C:\Users\…“ folder, the error also occurred!
So the cause was not a missing assembly but some kind of (weird?) policy thing.
Some further digging/googling finally lead to the solution on Stack Overflow. The solution was to add some more App.config settings.
My previous, non-working App.config file contained:
<startup>
<supportedRuntime version="v2.0.50727"/>
<supportedRuntime version="v4.0"/>
</startup>
My new, working App.config file was:
<startup useLegacyV2RuntimeActivationPolicy="true">
<supportedRuntime version="v2.0.50727"/>
<supportedRuntime version="v4.0"/>
</startup>
So it seems that setting „useLegacyV2RuntimeActivationPolicy“ to „true“ finally switched something to allow for loading mixed-mode DLLs from local folders. Doh!