Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I select debug vs release libraries automatically?

Using MS Visual Studio 2008, I created a C# library (let's call it main.dll) that relies on a second library (helper.dll). In the Debug version of main.dll, I set a reference to the debug version of helper.dll. But when I switch to build the Release version of main.dll, the output folder still includes the debug version of helper.dll. I do not see a way to select different versions of helper.dll for different build types. In C++, I could tell the linker what folder to get its files from, but I don't see a way to do that for C#.

like image 215
ROBERT RICHARDSON Avatar asked Apr 22 '26 21:04

ROBERT RICHARDSON


1 Answers

The typical way of doing this is to have all of your projects in a single solution, and use project references between them. Then, when you build in Debug, all components will be built and referenced as debug - and likewise for Release.

Alternatively, you can use a single output folder for all your assemblies, reference each binary from there, and ensure that the build order is correct - so that your helper.dll is built to that folder before main.dll is built. This is more prone to failure, though, and requires a greater amount of manual maintenance.

like image 151
Dan Puzey Avatar answered Apr 24 '26 09:04

Dan Puzey