Visual Studio loading the right (x86 or x64) dll!
I'm working on visual studio in an x86. I would like to build my application for both x32 and x64. But i need to use the sqlite .net connector wich has a dll for x86 apps and another dll for x64 apps. How do i configure my visual studio to load a reference when my configuration is x64 and another when my configuration is x86?
Thanks, Richard.
在参考项目文件中使用MSBUILD条件
<Reference
Include="SomeAssembly86, Version=0.85.5.452, Culture=neutral, PublicKeyToken=41b332442f1101cc, processorArchitecture=MSIL"
Condition=" '$(Platform)' == 'AnyCPU' ">
<SpecificVersion>False</SpecificVersion>
<HintPath>....DependenciesSomeAssembly.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference
Include="SomeOtherAssembly, Version=0.85.5.999, Culture=neutral, PublicKeyToken=41b332442f1101cc, processorArchitecture=MSIL"
Condition=" '$(Platform)' == 'x64' ">
<SpecificVersion>False</SpecificVersion>
<HintPath>....DependenciesSomeOtherAssembly.dll</HintPath>
<Private>False</Private>
</Reference>
This slightly simpler answer than Preet Sangha's will not generate a warning when the project is loaded and only the conditionally accepted dll will appear in the Solution Explorer. So, overall, the appearance is cleaner, although more subtle. (This was tested in Visual Studio 2010.)
<Reference Include="p4dn" Condition="$(Platform) == 'x86'">
<HintPath>....ThirdPartyP4.Netclr4x86p4dn.dll</HintPath>
</Reference>
<Reference Include="p4dn" Condition="$(Platform) == 'x64'">
<HintPath>....ThirdPartyP4.Netclr4x64p4dn.dll</HintPath>
</Reference>
您还可以构建“任何CPU”的应用程序并动态选择要加载的DLL。
链接地址: http://www.djcxy.com/p/66306.html上一篇: 为什么Console.Writeline,Console.Write不能在Visual Studio Express中工作?