I have a web application project which utilises a set of 3rd party dll\'s. The issue is that the dev/staging environment is 32bit, but production is 64bit. As such, we have
This is what I have figured out, and seems to work no problems.
I have created 2 solution platforms, x86 and x64. I have created a new folder in my solution directory called "References", and created n x86 and x64 folder: \References\x86\ \References\x64\ The 3 dll's for each are then placed in their respective directories.
In each project's file, I have then added the following references:
<Reference Include="{Reference1}" Condition="'$(Platform)'=='x86'">
<HintPath>..\References\dlls\x86\{Reference1}.dll</HintPath>
</Reference>
<Reference Include="{Reference2}" Condition="'$(Platform)'=='x64'">
<HintPath>..\References\dlls\x64\{Reference2}.dll</HintPath>
</Reference>
Now, when I develop within the IDE, I am working the the relevant dll specific to my needs.
I have then just added a post-build event which copies the dll based on the $(Platform) variable into the bin directory.
You can create conditional references in the project file like this:
<Reference Include="32bit.dll" Condition="'$(Platform)'=='x86'"/>
<Reference Include="64bit.dll" Condition="'$(Platform)'=='x64'"/>
To use this inside VS, you have to create two solution platforms: one for the x86 target and one for the x64 target. Depending on the active platform one of the dlls will be selected, no need for re-referencing.
To automate this using msbuild, create a new project file that builds the other project file a number of times, each time for a different platform/configuration/...:
<Target Name="BuildAll">
<MSBuild Targets="myproject.proj" Properties="Platform=x86;Configuration=Debug"/>
<MSBuild Targets="myproject.proj" Properties="Platform=x64;Configuration=Debug"/>
<MSBuild Targets="myproject.proj" Properties="Platform=x64;Configuration=Release"/>
</Target>
Have a look at the MSBuild task reference for aditional options like building in parallel.