Kelvin
Kelvin

Reputation: 61

Microsoft Visual Studio: Debugging multiple projects at once (executable that accesses functions in DLL + the DLL used by executable)

I was wondering how to debug multiple projects at once (specifically, project that builds into an executable and a project that builds into a DLL). More specifically, I want to step through the DLL, whose source is open to me.

I was wondering how to do this for both C++ and C# projects?

I think I know how to do this for the C# case:

  1. Create a new solution.
  2. Add both projects to the solution.
  3. Build the DLL project (as debug).
  4. Add a reference to the DLL that was built to the executable project (Does the working directory have to be the directory the debug DLL project was built in?)
  5. Set the executable project as the start up project and debug normally; you should be able to set breakpoints in the DLL, etc.

Does this sound correct? If not, could anyone tell me what I am missing?

More importantly, how do I do this for the C++ case? Thanks!

R

Upvotes: 3

Views: 1377

Answers (2)

vatsa
vatsa

Reputation: 9

Which editor you are using? If visual studio, you can run the project and link the exe at run time.Most of the steps you have already written.

Upvotes: 0

Ben Voigt
Ben Voigt

Reputation: 283634

Looks like you have most of the steps in place. Make sure the .pdb file is available to the debugger. The C++ compiler will automatically create it in the output directory, but Visual Studio copies referenced DLLs as part of the C# build process and probably didn't include that all-important debug data. Copying it to the C# output directory should be sufficient.

Upvotes: 2

Related Questions