开发者

Assemblies or files cannot be loaded when launching a exec

I meet following exception when I copy the whole program directoy to another machine. Which tools can I employ to debug it?开发者_Python百科 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)


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.


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.


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜