Assemblies or files cannot be loaded when launching a exec

2

I meet following exception when I copy the whole program directoy to another machine. Which tools can I employ to debug it? Thank you.

Unhandled Exception: System.TypeInitializationException: The type initializer fo r 'SomeClass' threw an exceptio n. ---> System.IO.FileLoadException: Could not load file or assembly 'SomeAssembly.dll, Version=0.0.0.0, Culture=neut ral, PublicKeyToken=null' or one of its dependencies. This application has faile d to start because the application configuration is incorrect. Reinstalling the application may fix this problem. (Exception from HRESULT: 0x800736B1) File name: 'SomeAssembly.dll, Version =0.0.0.0, Culture=neutral, PublicKeyToken=null' ---> System.Runtime.InteropServi ces.COMException (0x800736B1): This application has failed to start because the application configuration is incorrect. Reinstalling the application may fix thi s problem. (Exception from HRESULT: 0x800736B1)

.net
dependencies
asked on Stack Overflow Mar 2, 2010 by Ricky

3 Answers

4

It is a Windows error, not a .NET error. The error code is 14001, ERROR_SXS_CANT_GEN_ACTCTX, "The application has failed to start because its side-by-side configuration is incorrect. Please see the application event log for more detail."

Look in the Windows event log, it tells you what DLL you forgot to install on the target machine. If it is a mixed-mode assembly then it is typically the C/C++ runtime DLL, or you deployed the debug build.

answered on Stack Overflow Mar 2, 2010 by Hans Passant
1

You can use the fusion log to debug this sort of problem. It will show you where it is searching for the dependencies, and if it found them, and if it found them and failed to load them, why.

answered on Stack Overflow Mar 2, 2010 by Logan Capaldo
0

If you're just copying the files over, check that the dll's aren't being blocked by the OS. To check that, right click on the dll, go to Properties and look on the bottom right of the dialog under the Advanced button. If there's a button there that says "Unblock" then click it. You'll have to either do that to all of them, or else add them to the GAC using the gacutil utility.

Paul

answered on Stack Overflow Mar 2, 2010 by Paul

User contributions licensed under CC BY-SA 3.0