簡體   English   中英

嘗試創建SQLite數據庫時出現BadImageFormatException

[英]BadImageFormatException when trying to create a SQLite-Database

我遇到了一個非常奇怪的問題,並嘗試了在www中找到的幾種解決方案,但這並不能解決我的問題。

幾天前,我決定從圖元文件切換到數據庫,因為圖元文件幾乎用完了我的RAM的全部容量。 我選擇了SQLite,因為我不想強迫用戶僅運行程序就運行整個數據庫服務器。

因此,我將SQLite加載到筆記本電腦上,將其引用到我的項目中並繼續開發。 一切正常。 到家后,我打開了台式機並希望繼續進行開發(我的整個項目始終與我的保管箱保持同步)。 但是,只要代碼到達該區域,SQLite就會在該區域調用BadImageFormatException。

Google告訴我將我的應用程序切換到x86,但隨后崩潰...

這兩個系統都是x64 Windows 7。

我將dll移至/ bin / Debug / lib / x86 /和/ bin / Debug / lib / x64 /並編輯了.csproj-此解決方案中提供的文件,但這根本不起作用...

在同一解決方案/項目中使用Visual Studio定位32位和64位

我的.csproj文件現在看起來像這樣:

<ItemGroup>
    <Reference Include="System" />
    <Reference Include="System.Core" />
    <Reference Include="System.Data" />
    <Reference Include="System.Drawing" />
    <Reference Include="System.Windows.Forms" />
    <Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup Condition=" '$(Platform)' == 'x86' ">
    <Reference Include="System.Data.SQLite">
          <SpecificVersion>False</SpecificVersion>
          <HintPath>bin\Debug\lib\x86\System.Data.SQLite.dll</HintPath>
    </Reference>
</ItemGroup> 
<ItemGroup Condition=" '$(Platform)' == 'AMD64' ">
    <Reference Include="System.Data.SQLite">
        <SpecificVersion>False</SpecificVersion>
        <HintPath>bin\Debug\lib\x64\System.Data.SQLite.dll</HintPath>
    </Reference>
</ItemGroup>

提前致謝

從我們在評論中的討論中,您發現一個錯誤的圖像錯誤,因為文件已損壞。 也就是說,由於嘗試加載錯誤的圖像,因此出現了錯誤的圖像錯誤。

成因,見效。

暫無
暫無

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

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