.Net Application SideBySide loading fails COMException (0x80040154)


My .Net 4.5.2 WPF Application is deployed to C:\Program Files\Folder A\FolderB. Its copied to that location by a custom deployment service that is basically a copy job with some additional features. The application itself is xcopy deployable, given you have the required C++ runtimes, .Net Framework installed.

The application includes several com components, registered via the application manifest file, which used to work just fine. After an update to the applications binary files, several calls in the form System.Activator.CreateInstance fail

System.Runtime.InteropServices.COMException (0x80040154): Retrieving the COM class factory for component with CLSID {XXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXX} failed due to the following error: 80040154 Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)).

If i simply rename the application folder to c:\Program Files\FolderA\FolderC everything is working correctly

Attaching ProcessMonitor and WinDbg, i can trace that the application is searching the registry for the given classid, doesnt find it and then, if started from the first folder fails as described above. Started from the renamed or copied folder the process loads the associated dll and just goes on.

Any hints on diagnosing this issue?

asked on Stack Overflow Feb 1, 2019 by Dominik

1 Answer


To anyone struggeling as I did: as far as i currently see it, the problem was the SideBySide Cache.

In short, Windows caches the manifest information for an application, and if it determines the application has not changed, uses the cache (you will notice that the existing external manifest is never loaded by your process).

In my case the executable did not change, but the rest of the application, including the manifest information.

The solution is to touch the modification date of the executable, causing the cache to become invalidated.

Basically also answered in this question

answered on Stack Overflow Feb 2, 2019 by Dominik • edited Feb 2, 2019 by Dominik

User contributions licensed under CC BY-SA 3.0