I have VS2010 solution with 3 projects:
I can set the managed DLL as a Reference to the console app, but I cannot set the native DLL as such a Reference.
To run the console app from within VS2010 without a crash, I must copy the native DLL to the .exe folder.
I have 2 questions:
More Detailed Solution - due to Tilak's answer:
Here are more newbie friendly details based Tilak's reply below:
.csproj
file in a text editor and find the <ItemGroup>
which includes the native DLL name (this was created when we added the file in step 1). We'll make several small changes there:
<ItemGroup>
use <ItemGroup Condition="'$(DefineConstants)' == 'DEBUG;TRACE' ">
and enter the path to the Debug DLL.<ItemGroup>
use <ItemGroup Condition="'$(DefineConstants)' != 'DEBUG;TRACE' ">
and enter the path to the Release DLL.You can with copy the files in post build event,
or
Add files as resources.
How can I do this so that each configuration (Debug/Release) takes the correct DLL version?
You can use $(ConfigurationName)
in post build event to find out Debug/Release mode. And accordingly you can refer the libraries.
If you are using resource approach, you have to modify the project file to copy based on Debug/Release mode. See details here
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