Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions src/BuiltInTools/Watch/Process/LaunchSettingsProfile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ internal sealed class LaunchSettingsProfile

internal static LaunchSettingsProfile? ReadLaunchProfile(string projectPath, string? launchProfileName, ILogger logger)
{
var launchSettingsPath = LaunchSettingsLocator.TryFindLaunchSettings(projectPath, launchProfileName, (message, isError) =>
var launchSettingsPath = LaunchSettings.TryFindLaunchSettingsFile(projectPath, launchProfileName, (message, isError) =>
{
if (isError)
{
Expand Down Expand Up @@ -94,11 +94,16 @@ internal sealed class LaunchSettingsProfile
return null;
}

var defaultProfileKey = launchSettings.Profiles.FirstOrDefault(entry => entry.Value.CommandName == "Project").Key;
// Look for the first profile with a supported command name
// Note: These must match the command names supported by LaunchSettingsManager in src/Cli/dotnet/Commands/Run/LaunchSettings/
var supportedCommandNames = new[] { "Project", "Executable" };
var defaultProfileKey = launchSettings.Profiles.FirstOrDefault(entry =>
entry.Value.CommandName != null && supportedCommandNames.Contains(entry.Value.CommandName, StringComparer.Ordinal)).Key;

if (defaultProfileKey is null)
{
logger.LogDebug("Unable to find 'Project' command in the default launch profile.");
logger.LogDebug("Unable to find a supported command name in the default launch profile. Supported types: {SupportedTypes}",
string.Join(", ", supportedCommandNames));
return null;
}

Expand Down
27 changes: 0 additions & 27 deletions src/Cli/dotnet/Commands/CliCommandStrings.resx
Original file line number Diff line number Diff line change
Expand Up @@ -744,9 +744,6 @@ See https://aka.ms/dotnet-test/mtp for more information.</value>
<data name="Date" xml:space="preserve">
<value>Date</value>
</data>
<data name="DefaultLaunchProfileDisplayName" xml:space="preserve">
<value>(Default)</value>
</data>
<data name="DeletingWorkloadManifest" xml:space="preserve">
<value>Uninstalling workload manifest {0} version {1}...</value>
</data>
Expand All @@ -766,10 +763,6 @@ See https://aka.ms/dotnet-test/mtp for more information.</value>
<data name="DescriptionColumnName" xml:space="preserve">
<value>Description</value>
</data>
<data name="DeserializationExceptionMessage" xml:space="preserve">
<value>An error was encountered when reading '{0}': {1}</value>
<comment>{0} is file path. {1} is exception message.</comment>
</data>
<data name="DetailDescription" xml:space="preserve">
<value>Show detail result of the query.</value>
</data>
Expand Down Expand Up @@ -812,11 +805,6 @@ See https://aka.ms/dotnet-test/mtp for more information.</value>
<data name="DownloadToCacheOptionDescription" xml:space="preserve">
<value>Download packages needed to install a workload to a folder that can be used for offline installation.</value>
</data>
<data name="DuplicateCaseInsensitiveLaunchProfileNames" xml:space="preserve">
<value>There are several launch profiles with case-sensitive names, which isn't permitted:
{0}
Make the profile names distinct.</value>
</data>
<data name="ExactMatchDescription" xml:space="preserve">
<value>Require that the search term exactly match the name of the package. Causes `--take` and `--skip` options to be ignored.</value>
</data>
Expand Down Expand Up @@ -1033,18 +1021,6 @@ Make the profile names distinct.</value>
<value>Latest Version</value>
<comment>Table lable</comment>
</data>
<data name="LaunchProfileDoesNotExist" xml:space="preserve">
<value>A launch profile with the name '{0}' doesn't exist.</value>
</data>
<data name="LaunchProfileHandlerCannotBeLocated" xml:space="preserve">
<value>The launch profile type '{0}' is not supported.</value>
</data>
<data name="LaunchProfileIsNotAJsonObject" xml:space="preserve">
<value>A profile with the specified name isn't a valid JSON object.</value>
</data>
<data name="LaunchProfilesCollectionIsNotAJsonObject" xml:space="preserve">
<value>The 'profiles' property of the launch settings document is not a JSON object.</value>
</data>
<data name="ListAppFullName" xml:space="preserve">
<value>List all projects in a solution file.</value>
</data>
Expand Down Expand Up @@ -2266,9 +2242,6 @@ and the corresponding package Ids for installed tools using the command
<data name="UpdateToolFailed" xml:space="preserve">
<value>Tool '{0}' failed to update due to the following:</value>
</data>
<data name="UsableLaunchProfileCannotBeLocated" xml:space="preserve">
<value>A usable launch profile could not be located.</value>
</data>
<data name="Usage" xml:space="preserve">
<value>Usage</value>
</data>
Expand Down
5 changes: 2 additions & 3 deletions src/Cli/dotnet/Commands/Run/Api/RunApiCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,8 @@ public override RunApiOutput Execute()
environmentVariables: ReadOnlyDictionary<string, string>.Empty,
msbuildRestoreProperties: ReadOnlyDictionary<string, string>.Empty);

runCommand.TryGetLaunchProfileSettingsIfNeeded(out var launchSettings);
var targetCommand = (Utils.Command)runCommand.GetTargetCommand(buildCommand.CreateProjectInstance, cachedRunProperties: null);
runCommand.ApplyLaunchSettingsProfileToCommand(targetCommand, launchSettings);
var result = runCommand.ReadLaunchProfileSettings();
var targetCommand = (Utils.Command)runCommand.GetTargetCommand(result.Profile, buildCommand.CreateProjectInstance, cachedRunProperties: null);

return new RunApiOutput.RunCommand
{
Expand Down

This file was deleted.

This file was deleted.

145 changes: 0 additions & 145 deletions src/Cli/dotnet/Commands/Run/LaunchSettings/LaunchSettingsManager.cs

This file was deleted.

This file was deleted.

Loading