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

Viewed 6757

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?

2 Answers

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.

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

No. Usually you would use Start Project, unless you have an external program that needs to be started in order to debug your project.

I have used this myself in quite some cases, primarily when developing add-ins for other software, like a class library that is actually a plugin for Autodesk Revit, unsupported Microsoft Office versions, etc.

Related