Search code examples
c#debuggingvisual-studio-2019multitargeting

How do you select which build target to debug?


If I am multitargeting a project to .Net Core 3.1 and .Net Framework 4.8 and I select Debug | Start Debugging, Visual Studio 2019 starts a debugging session with the .Net Framework build target.

How can I get it to launch the .Net Core build target instead?

Here is my test project file:

<PropertyGroup>
  <OutputType>Exe</OutputType>
  <TargetFrameworks>net48;netcoreapp3.1</TargetFrameworks>
</PropertyGroup>

And here is the test code:

using System;

namespace Demo
{
    class Program
    {
        public static void Main(string[] args)
        {
            #if NET48
                Console.WriteLine(".Net Framework");
            #else
                Console.WriteLine(".Net Core");
            #endif
        }
    }
}

There are no other files in the project. I'm using Visual Studio 2019 version 16.7.2.


Solution

  • Just to make it obvious, If you click the dropdown next to your start debug toolbar item, you will see your targeting options

    enter image description here

    Note : I am trying to find the actual documentation for this... zilch