VS中 C# 引用 32位和64位两种版本

例如 引用System.Data.SQLite,此dll需要区分32位和64位

首先,先再解决方案中引用System.Data.SQLite

找到对应的 工程名.csproj。使用文本编辑器打开 这个文件 (记事本或者其他类似工具),这是一个使用xml方式的工程文件 。找到加载库的地方

  1. <Reference Include="System.Data.SQLite">
  2. <SpecificVersion>False</SpecificVersion>
  3. <HintPath>..\..\lib\System.Data.SQLite\net4.0\x86\2010\bin\System.Data.SQLite.dll</HintPath>
  4. </Reference>

更改为

  1. <Reference Condition=" '$(Platform)' == 'x86'" Include="System.Data.SQLite">
  2. <SpecificVersion>False</SpecificVersion>
  3. <HintPath>..\..\lib\System.Data.SQLite\net4.0\x86\2010\bin\System.Data.SQLite.dll</HintPath>
  4. </Reference>
  5. <Reference Condition=" '$(Platform)' == 'x64'" Include="System.Data.SQLite">
  6. <SpecificVersion>False</SpecificVersion>
  7. <HintPath>..\..\lib\System.Data.SQLite\net4.0\x64\2010\bin\System.Data.SQLite.dll</HintPath>
  8. </Reference>

 

(0)

相关推荐