gonzalomelov
gonzalomelov

Reputation: 981

Debug Multiple Solutions VS 2012

I have been trying to debug a class library in a Solution A with a MVC project in Solution B. I run Solution B, set a breakpoint in Solution A, but the debugger never gets into Solution A.

I have already tried with this answer and this answer with no success.

How can I debug multiple Solutions in VS2012?

Thanks!

Upvotes: 0

Views: 5455

Answers (2)

DigCamara
DigCamara

Reputation: 5568

There are some ways to do this. But the easiest would be:

  1. Start Solution B
  2. Go to Solution A
  3. Go to Debug->Attach to Process...
  4. Choose the executable you're running (from Solution B, of course. You may have to check "Show processes from all users")

You need to link your Solution A to Solution B's debuggable version for this to work. Usually it's in the bin\Debug subdirectory of your project. In that case, your Breakpoint should be hit as soon as it's reached.

Another way would be:

  1. Open Solution A's properties.
  2. Go to Debug
  3. Under "Start Action" choose "Start external program:"
  4. Browse to Solution B's executable

Run Solution A.

Yet another way would be to insert into your class library the sentence Debugger.Break(); (which requires using System.Diagnostics;). Be careful to not release the debug version, though! As soon as it's reached, the System should throw up a dialog box asking if you'd like to debug the process. This process depends on the correct installation of all components as well...

Upvotes: 1

Richard Walters
Richard Walters

Reputation: 1474

Make a Solution C which contains both the class library from Solution A as well as the MVC project in Solution B. This will not require any changes or copies to the class library project or MVC project. In fact, you can keep those where they are, and simply add the existing projects to the new Solution C.

Upvotes: 0

Related Questions