Home > Enterprise >  New Project Debug Dialog in Visual Studio 2022--Why and How It Changed?
New Project Debug Dialog in Visual Studio 2022--Why and How It Changed?

Time:01-29

I have a .NET 4.8 C# WinForms project loaded in Visual Studio Enterprise 2022. The Debug section of the project properties page (right-click the project in Solution Explorer and choose Properties...) looks something like this:

enter image description here

Notice that there is a clear Start action section.

I have another .NET 4.8 C# WinForms project loaded in Visual Studio Enterprise 2022. The Debug section of this project properties dialog looks something like this:

enter image description here

Notice that the Debug General section now states:

The management of launch profiles has moved to a dedicated dialog. It may be accessed via the link below, via the Debug menu in the menu bar, or via the Debug Target command on the Standard tool bar.

Other posters here and elsewhere on the web have concluded that (a) the new (latter) dialog is due to Visual Studio 2022 (it is not, as both sampled above appeared in Visual Studio 2022 Enterprise; or (b) that this occurs for only projects that are .NET Core projects (that's not true either--both projects above are WinForms 4.8 projects). So if it's not Visual Studio 2022, and it's not .NET Core--then what is it? What causes the former Debug property page to be replaced with the new "dedicated dialog" version?

Moreover, how do you set a StartAction when StartAction no longer appears on the Debug dialog?

[P.S. Please don't reprimand me for posting screen images--they serve a very clear purpose here and I included the searchable text that appears on those dialog boxes in my question so that this post can be found by others who encounter a similar issue...]

CodePudding user response:

How/why does it show different project property pages for two .NET 4.8 projects?

It's about the project format:

  • The project files with MSBuild project format will use the old Debug settings window.
  • The project files with SDK project format will use the new Debug settings window.

How to set StartAction for SDK style projects?

In project properties, go to Debug section, General, and click on "Open debug launch profiles UI".

  • You can specify command line arguments for the current debug profile.
  • Or you can create a new profile (Executable) and specify the executable if you want (like specifying VS, when you want to debug design time of VS).

After you created the new profile, you can just choose it from debug toolbar dropdown button and start that profile.


Rest of the answer is just for people who want to see the difference between project format, and also see those new project debug settings.

MSBuild Project format

<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    <ProjectGuid>{DE16D3B5-E02E-44A1-B223-2C25ED3F14D9}</ProjectGuid>
    <OutputType>WinExe</OutputType>
    <RootNamespace>WindowsFormsApp1</RootNamespace>
    <AssemblyName>WindowsFormsApp1</AssemblyName>
    <TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
    <FileAlignment>512</FileAlignment>
    <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
    <Deterministic>true</Deterministic>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
    <PlatformTarget>AnyCPU</PlatformTarget>
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <Optimize>false</Optimize>
    <OutputPath>bin\Debug\</OutputPath>
    <DefineConstants>DEBUG;TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
    <PlatformTarget>AnyCPU</PlatformTarget>
    <DebugType>pdbonly</DebugType>
    <Optimize>true</Optimize>
    <OutputPath>bin\Release\</OutputPath>
    <DefineConstants>TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
  </PropertyGroup>
  <ItemGroup>
    <Reference Include="System" />
    <Reference Include="System.Core" />
    <Reference Include="System.Xml.Linq" />
    <Reference Include="System.Data.DataSetExtensions" />
    <Reference Include="Microsoft.CSharp" />
    <Reference Include="System.Data" />
    <Reference Include="System.Deployment" />
    <Reference Include="System.Drawing" />
    <Reference Include="System.Net.Http" />
    <Reference Include="System.Windows.Forms" />
    <Reference Include="System.Xml" />
  </ItemGroup>
  <ItemGroup>
    <Compile Include="Form1.cs">
      <SubType>Form</SubType>
    </Compile>
    <Compile Include="Form1.Designer.cs">
      <DependentUpon>Form1.cs</DependentUpon>
    </Compile>
    <Compile Include="Program.cs" />
  </ItemGroup>
  <ItemGroup>
    <Folder Include="Properties\" />
  </ItemGroup>
  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

SDK Project format

<Project Sdk="Microsoft.NET.Sdk">
    <PropertyGroup>
        <OutputType>WinExe</OutputType>
        <TargetFramework>net48</TargetFramework>
        <LangVersion>10.0</LangVersion>
        <ImplicitUsings>enable</ImplicitUsings>
    </PropertyGroup>
    <ItemGroup>
        <Reference Include="System" />
        <Reference Include="System.Core" />
        <Reference Include="System.Xml.Linq" />
        <Reference Include="System.Data.DataSetExtensions" />
        <Reference Include="Microsoft.CSharp" />
        <Reference Include="System.Data" />
        <Reference Include="System.Deployment" />
        <Reference Include="System.Drawing" />
        <Reference Include="System.Net.Http" />
        <Reference Include="System.Windows.Forms" />
        <Reference Include="System.Xml" />
    </ItemGroup>
    <ItemGroup>
        <Using Include="System.Windows.Forms" />
    </ItemGroup>
</Project>

enter image description here

enter image description here

enter image description here

  • Related