簡體   English   中英

您的應用程序中發生了未處理的異常……無法加載文件或程序集

[英]Unhandled exception has occurred in your application … Could not load file or assembly

當我預先開發的應用程序在另一台計算機上打開時,我遇到了問題。 顯示此警告,並且應用程序未運行。

“您的應用程序中發生了未處理的異常。如果單擊“繼續”,則該應用程序將忽略此錯誤並嘗試繼續。如果單擊“退出”,該應用程序將立即關閉。'TopAuto.MAINMODULE'的類型初始化程序引發了異常。”

詳細信息是:

See the end of this message for details on invoking 
just-in-time (JIT) debugging instead of this dialog box.

************** Exception Text **************
System.TypeInitializationException: The type initializer for 'TopAuto.MAINMODULE' threw an exception. ---> System.IO.FileNotFoundException: Could not load file or assembly 'CrystalDecisions.Shared, Version=10.5.3700.0, Culture=neutral, PublicKeyToken=692fbea5521e1304' or one of its dependencies. The system cannot find the file specified.
File name: 'CrystalDecisions.Shared, Version=10.5.3700.0, Culture=neutral, PublicKeyToken=692fbea5521e1304'
   at TopAuto.MAINMODULE..cctor()

WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure logging.
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].

   --- End of inner exception stack trace ---
   at TopAuto.MAINMODULE.checkServer()
   at TopAuto.FrmLogin.btnLogIn_Click(Object sender, EventArgs e) in E:\A Sale Software Project\TopAuto\TopAuto\Form\FrmLogin.vb:line 292
   at System.Windows.Forms.Control.OnClick(EventArgs e)
   at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
   at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ButtonBase.WndProc(Message& m)
   at System.Windows.Forms.Button.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)


************** Loaded Assemblies **************
mscorlib
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.8762 (QFE.050727-8700)
    CodeBase: file:///C:/Windows/Microsoft.NET/Framework64/v2.0.50727/mscorlib.dll
----------------------------------------
TopAuto
    Assembly Version: 22.0.7.14
    Win32 Version: 22.0.7.14
    CodeBase: file:///D:/newsoft/TopAuto.exe
----------------------------------------
Microsoft.VisualBasic
    Assembly Version: 8.0.0.0
    Win32 Version: 8.0.50727.7057 (QFE.050727-7000)
    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/Microsoft.VisualBasic/8.0.0.0__b03f5f7f11d50a3a/Microsoft.VisualBasic.dll
----------------------------------------
System
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.8770 (QFE.050727-8700)
    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
System.Windows.Forms
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.8653 (QFE.050727-8600)
    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Windows.Forms/2.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
System.Drawing
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.8681 (QFE.050727-8600)
    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Drawing/2.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------
System.Runtime.Remoting
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.8771 (QFE.050727-8700)
    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Runtime.Remoting/2.0.0.0__b77a5c561934e089/System.Runtime.Remoting.dll
----------------------------------------
DevComponents.DotNetBar2
    Assembly Version: 7.0.0.4
    Win32 Version: 7.0.0.4
    CodeBase: file:///D:/newsoft/DevComponents.DotNetBar2.DLL
----------------------------------------
Accessibility
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.7057 (QFE.050727-7000)
    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/Accessibility/2.0.0.0__b03f5f7f11d50a3a/Accessibility.dll
----------------------------------------
System.Data
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.8762 (QFE.050727-8700)
    CodeBase: file:///C:/Windows/assembly/GAC_64/System.Data/2.0.0.0__b77a5c561934e089/System.Data.dll
----------------------------------------
System.Xml
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.8773 (QFE.050727-8700)
    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Xml/2.0.0.0__b77a5c561934e089/System.Xml.dll
----------------------------------------
System.Configuration
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.7057 (QFE.050727-7000)
    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Configuration/2.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll
----------------------------------------

************** JIT Debugging **************
To enable just-in-time (JIT) debugging, the .config file for this
application or computer (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.

For example:

<configuration>
    <system.windows.forms jitDebugging="true" />
</configuration>

When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the computer
rather than be handled by this dialog box.

第二段是您的問題的答案:

System.TypeInitializationException:“ TopAuto.MAINMODULE”的類型初始值設定項引發了異常。 ---> System.IO.FileNotFoundException:無法加載文件或程序集“ CrystalDecisions.Shared,版本= 10.5.3700.0,Culture = neutral,PublicKeyToken = 692fbea5521e1304”或其依賴項之一。 系統找不到指定的文件。

盡管您已將應用程序編譯為可執行文件,但它具有一些依賴性:.NET庫(已按消息狀態成功加載)之外,它還需要一些名為CrystalDecisions.Shared的庫來進行動態鏈接。

這個問題的解決方案幾乎是困難的:您必須通過將應用程序復制到可執行文件所駐留的同一目錄(或文件夾結構中的相應相對路徑)來為應用程序提供所需的dll,或者該應用程序具有更高的可移植性。但無法更新,請重新編譯應用程序並將其與庫靜態鏈接。 這會將您的庫包含到可執行文件本身中,從而產生一個.exe文件,該文件可以自行移動和復制。 靜態鏈接通常可以提高性能,因為您的程序可以簡單地從一個位置跳轉到另一個位置,而無需動態加載某些庫,但這可以忽略不計,並且與您的問題無關。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM