1

我遇到了一个非常奇怪的问题,并尝试了在 www 中找到的几种解决方案,但这并没有解决我的问题。

几天前,我决定从元文件切换到数据库,因为元文件几乎用尽了我的 RAM 容量。我选择了 SQLite,因为我不想强迫用户运行整个数据库服务器只是为了运行我的程序。

所以我将 SQLite 加载到我的笔记本电脑上,将其引用到我的项目中并继续开发。一切正常。回到家后,我打开了台式电脑并想继续开发(我的整个项目总是与我的 Dropbox 同步)。但是,一旦代码到达该区域,SQLite 调用的地方就让我得到了一个 BadImageFormatException。

谷歌告诉我将我的应用程序切换到 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>

提前致谢

4

1 回答 1

0

从我们在评论中的讨论中,您会收到错误的图像错误,因为文件已损坏。也就是说,您会收到错误的图像错误,因为您正在尝试加载错误的图像。

因,遇果。

于 2012-01-26T11:07:58.473 回答