根据C#中的体系结构引用不同的库

pba*_*aga 2 c# visual-studio-2010

是否有可能在我的C#项目中添加对x86和x64中不同dll版本的引用(并在更改配置模式时自动切换它们)?

小智 8

我不认为IDE中有任何内容可以执行此操作,但您可以通过手动编辑C#项目文件来实现此目的.

看起来像: <Reference Include="ThirdPartyAssembly" />

可以改为: <Reference Include="ThirdPartyAssembly.x86" Condition="'$(Platform)' == 'x86' /> <Reference Include="ThirdPartyAssembly.x64" Condition="'$(Platform)' == 'x64' />

  • 更加紧凑的是&lt;Reference Include =“ ThirdPartyAssembly。$(Platform)” /&gt; (2认同)