Debug Multiple Solutions VS 2012

Deadly 提交于 2019-12-13 05:03:37

问题


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!


回答1:


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...




回答2:


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.



来源:https://stackoverflow.com/questions/16364585/debug-multiple-solutions-vs-2012

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!