Reputation: 90465
I have 2 projects
When I want to run the .NET app I have to build the C++ library manually and copy the binary to the .NET app output folder, so it can Work.
How to automate this?
Upvotes: 0
Views: 275
Reputation: 941237
First make sure you've got a solution with both projects. Right-click the C++ project, Properties, Configuration Properties, General. Change the Output Directory setting to
$(SolutionDir)bin\$(ConfigurationName)
Repeat for the Release configuration (upper left combo). That ensures the C++ build is using the same folder naming strategy as the .NET build (bin\Debug and bin\Release).
Now right-click the .NET project, Project Dependencies and tick the C++ project. That ensures that the C++ project gets built first and that the build output gets copied to your .NET build folder.
Upvotes: 3
Reputation: 10979
You can make the output folder of both projects same folder. Then you do not need to copy.
Upvotes: 1
Reputation: 880
You can use post-build event, which can be found in Build events under project properties. You can write commands to compile your C++ prjects using MSBuild if needed and copy resulting dll to needed directory.
For example copy ..\..\include\crash_rpt\bin\dbghelp\dbghelp.dll ..\bin\debug
Upvotes: 1