I am writing a C # application using Visual Studio 2015. This application is for “any processor” (without the “Prefer 32-bit” option), which means that the application is compiled into one build target, which will run in 32-bit at 32 -bit operating systems and 64-bit mode in 64-bit operating systems.
For this application, you need to copy some native DLL into its output folder (i.e. bin / Debug or bin / Release folder). There are separate x86 and x64 versions of this DLL, and the correct copy must be copied to the output folder depending on the operating system of the developer.
Until now, I realized that I can copy files to the output folder conditionally by adding something like the following to the .csproj file:
<ItemGroup Condition="MY CONDITION HERE"> <Content Include="MyNativeLib.dll"> <CopyToOutputDirectory>Always</CopyToOutputDirectory> </Content> </ItemGroup>
So my question is: how to write a condition equivalent to "developer operating system: x86" or "... x64"?
(To be extremely clear, I do not ask how to copy the file conditionally to the platform build target, which in my case is always “Any processor.” I ask how to copy the file conditionally depending on the OS on which Visual Studio is running.)
source share