操作系統:Windows 8.1 64無法加載文件或程序集X或其某個依賴項。不是有效的Win32應用程序。 (HRESULT:0x800700C1)
我試圖用DirectX在VB.Net中播放多個聲音,在我的代碼中沒有錯誤。 問題是每當事件觸發我得到這個錯誤
System.BadImageFormatException was unhandled Message: An unhandled exception of type 'System.BadImageFormatException' occurred in System.Windows.Forms.dll Additional information: Could not load file or assembly 'Microsoft.DirectX.AudioVideoPlayback.dll' or one of its dependencies. is not a valid Win32 application. (Exception from HRESULT: 0x800700C1)
然後我設定的目標的CPU x86和我得到這個錯誤
System.IO.FileLoadException was unhandled Message: An unhandled exception of type 'System.IO.FileLoadException' occurred in System.Windows.Forms.dll Additional information: Mixed mode assembly is built against version 'v1.1.4322' of the runtime and cannot be loaded in the 4.0 runtime without additional configuration information.
到目前爲止,我已經嘗試卸載,重新安裝的DirectX SDK,安裝與DirectX和不同聲音文件(.wav)有關的所有內容。 此外,我不得不瀏覽加載.dlls,我找不到它們在參考管理器>組件,但現在我甚至不能通過瀏覽加載它們,所以我使用Imports Microsoft.DirectX.AudioVideoPlayback
它會讓我導入其餘.dlls除了(引用管理器甚至不會打開它們):
Microsoft.DirectX.AudioVideoPlayback.dll
Microsoft.DirectX.dll
Microsoft.DirectX.DirectSound.dll
我需要的那些。有沒有辦法清理重新安裝它們?
Target Framework: .Net Framework 4.5
CODE:
Dim MySound1 As New Microsoft.DirectX.AudioVideoPlayback.Audio("D:\path\sound_file.mp3")
MySound1.Play()
讓我知道如果你需要知道的一切。
UPDATE: 我改變了Target Framework
到.Net Framework 3.5
,它工作正常,但只有在CPU Target
設置爲x86
!這是爲什麼?
糟糕的圖像聲音對我來說可能是聲音file.did你嘗試並使用其他聲音文件。或mybe嘗試一個.wav – Creator 2014-10-12 14:58:38
'BadImageFormatException'通常是一個32位/ 64位問題。 DirectX庫是否與您的應用程序相同? – pmcoltrane 2014-10-12 15:28:51
試過一個.wav文件 - 沒有工作。我將目標CPU設置爲x86,現在出現此錯誤: ***「System.IO.FileLoadException未處理 消息:在System.Windows.Forms.dll中發生未處理的類型爲」System.IO.FileLoadException「的異常。信息:混合模式程序集是針對運行時版本「v1.1.4322」構建的,無法在4中加載。0運行時>沒有額外的配置信息。「*** – 21CmOfPain 2014-10-12 17:31:10