I'd like to make a x86 and x64 version of my application because some of the libraries I'm using have differences for x86 and x64 (e.g. SQLite). I made a new configuration for release builds that has as target operating system "x64".
Is there a way to define different DLLs for the configuration e.g. use SQLite.dll for x86 release and SQLite64.dll for x64 release?
DLL dependenciesWhen a program or a DLL uses a DLL function in another DLL, a dependency is created. The program is no longer self-contained, and the program may experience problems if the dependency is broken.
To configure a project to target a different platformOn the menu bar, choose Build > Configuration Manager. In the Active solution platform list, choose a platform for the solution to target, and then choose the Close button.
You can add conditions to the dll references in the project file but you cannot do it using Visual Studio - you will have to hand-edit the project files. See this for how to do it.
What you need to do is to include a reference to the 32-bit dll only in the 32-bit build configuration, and a reference to the 64-bit dll in the 64-bit build configuration.
You need a condition to the dll reference in the project file.
This will cause visual studio to recheck the condition and reference whenever you change the active configuration.
Just add a condition for each configuration.
Example:
<ItemGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
<Reference Include="DLLName">
<HintPath>..\DLLName.dll</HintPath>
</Reference>
<ProjectReference Include="..\MyOtherProject.vcxproj">
<Project>{AAAAAA-000000-BBBB-CCCC-TTTTTTTTTT}</Project>
<Name>MyOtherProject</Name>
</ProjectReference>
</ItemGroup>
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