Search code examples
c#debuggingvisual-studio-debugging

What is the usage of Debug -> Start external program in Visual Studio


I have created two solutions in Visual Studio 2017:

  • first one with console application Example1
  • second one with class library ClassLibrary1

ClassLibrary1 contains only one file MyLib.cs:

namespace ClassLibrary1
{
    public class MyLib
    {
        public string Foo()
        {
            return "Bla";
        }
    }
}

In first solution (the one with Example1 console application) I added existing project -> ClassLibrary1.

I configured ClassLibrary1 as a Startup project and set Debug -> Start external program as shown in the picture:

enter image description here

So now you just start the project (in my case ClassLibrary1) and the Debug works (I set breakpoint in the return "Bla";). What happens is that Example1.exe calls ClassLibrary.MyLib file.

Have I understood the Debug -> Start external program correctly usage or is there any other usage?


Solution

  • You normally use it if you have something external starting up your code. Like, if you are developing a DLL, and some other process outside your project starts it up.

    For example you could be developing a plugin ThingyPlugin for Thingy.exe. Then you would specify Thingy.exe here as a means to get your plugin loaded.

    If you don't have an external process, you might as well use Start Project.