Since we have three assemblies that come in explicit x86 and x64 versions, I've edited the corresponding .csproj file(s) to use, for example, a block like this:
<ItemGroup Condition=" '$(Platform)' == 'x86' ">
<Reference Include="CaliberRMSDK">
<HintPath>..\Libraries\CaliberRMSDK_IKVM\32bit\CaliberRMSDK.dll</HintPath>
</Reference>
<Content Include="..\Libraries\CaliberRMSDK_IKVM\32bit\ikvm-native.dll">
<Link>ikvm-native.dll</Link>
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="..\Libraries\CaliberRMSDK_IKVM\32bit\JVM.dll">
<Link>JVM.dll</Link>
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup Condition=" '$(Platform)' == 'x64' ">
<Reference Include="CaliberRMSDK">
<HintPath>..\Libraries\CaliberRMSDK_IKVM\64bit\CaliberRMSDK.dll</HintPath>
</Reference>
<Content Include="..\Libraries\CaliberRMSDK_IKVM\64bit\ikvm-native.dll">
<Link>ikvm-native.dll</Link>
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="..\Libraries\CaliberRMSDK_IKVM\64bit\JVM.dll">
<Link>JVM.dll</Link>
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
</ItemGroup>
When reloading the .csproj file in Visual Studio 2010 and using 'x86' as platform, all works perfectly fine. When choosing 'x64' as platform, the proper 64bit assembly reference is used BUT the linked ( <Content Include= ...>
..) always uses the 32bit ones (and therefore the app is broken).
There's no Any CPU anymore in the project files and I would have 'expected' it to work just fine for the content includes, too.. but it doesn't. Is there anything I am missing?
We put the Condition attribute on the Reference element and that works fine. Perhaps the Condition attribute also needs to be added to the Content element? (Do you really need both the Reference element and the Content element?) For example:
<Reference Include="SomeLib" Condition="$(Platform)=='x86'">
<HintPath>..\..\ThirdParty\SomeLib\clr4\x86\SomeLib.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="SomeLib" Condition="$(Platform)=='x64' Or $(Platform)=='AnyCPU'">
<HintPath>..\..\ThirdParty\SomeLib\clr4\x64\SomeLib.dll</HintPath>
</Reference>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With