When a test project is added to a solution containing a console or web application project, the test project appears in the Startup Project dropdown menu. The test project can be selected as the startup project by default when Visual Studio is first opened. If there are many test projects, it becomes difficult to find and select the actual intended startup project.
I would like to configure the projects or solution so that test projects don't appear in the Startup Project menu.
I'm using Visual Studio 2022 and .NET 6. My test projects use MSTest. Here's an example created using the ASP.NET Core Web API, MSTest Test Project, and Class Library templates. Notice how WebApplication and TestProject both appear in the Startup Project selector, but ClassLibrary does not.
WebApplication.csproj:
net6.0
enable
enable
TestProject.csproj:
net6.0
enable
enable
false
ClassLibrary.csproj:
net6.0
enable
enable
WebApplication.sln:
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.5.33424.131
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WebApplication", "WebApplication\WebApplication.csproj", "{01F0A111-DEF7-412E-A9C5-DAA00C1FF909}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TestProject", "TestProject\TestProject.csproj", "{DB4D909F-B896-4B66-994A-B42C071DB6F1}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ClassLibrary", "ClassLibrary\ClassLibrary.csproj", "{DA28A343-376E-45AA-BD06-80DA4896AA1F}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{01F0A111-DEF7-412E-A9C5-DAA00C1FF909}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{01F0A111-DEF7-412E-A9C5-DAA00C1FF909}.Debug|Any CPU.Build.0 = Debug|Any CPU
{01F0A111-DEF7-412E-A9C5-DAA00C1FF909}.Release|Any CPU.ActiveCfg = Release|Any CPU
{01F0A111-DEF7-412E-A9C5-DAA00C1FF909}.Release|Any CPU.Build.0 = Release|Any CPU
{DB4D909F-B896-4B66-994A-B42C071DB6F1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{DB4D909F-B896-4B66-994A-B42C071DB6F1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DB4D909F-B896-4B66-994A-B42C071DB6F1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DB4D909F-B896-4B66-994A-B42C071DB6F1}.Release|Any CPU.Build.0 = Release|Any CPU
{DA28A343-376E-45AA-BD06-80DA4896AA1F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{DA28A343-376E-45AA-BD06-80DA4896AA1F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DA28A343-376E-45AA-BD06-80DA4896AA1F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DA28A343-376E-45AA-BD06-80DA4896AA1F}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {2210AA20-D0E8-418D-9796-B47D837831A1}
EndGlobalSection
EndGlobal
The test projects appear to have an Output Type of Console Application, so I've tried changing it to Class Library. When I make this change in the project's Properties view in Visual Studio, the selection is immediately changed back to Console Application. This does add to the project file, but the project still appears in the Startup Project dropdown.

