I am trying to build a project that can be built in both x64 and x86. I am using SlimDX to be the interop to DirectSound. I cannot change this, as it is part of a bigger application.
I am trying to reference the x86 version of SlimDX when the project is set to build in Win32/x86, and to reference the x64 version of SlimDX when I am building in AnyCPU. Is this possible? I have tried using conditions in the csproj file, but that does not seem to be working.
<ItemGroup>
<Reference Include="SlimDX, Version=4.0.13.43, Culture=neutral, PublicKeyToken=b1b0c32fd1ffe4f9" Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\SlimDX\x86\SlimDX.dll</HintPath>
</Reference>
<Reference Include="SlimDX, Version=4.0.13.43, Culture=neutral, PublicKeyToken=b1b0c32fd1ffe4f9" Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\SlimDX\x64\SlimDX.dll</HintPath>
</Reference>
<ItemGroup>
This is possible, you can also add the platform target directly in the path:
Visual studio will send you some architecture mismatch warnings, but in your case they can be safely ignored (as you will boot in 64 bits at the end).