Skip to content

Commit 41c6d4b

Browse files
authored
Change from "sln" to "solution" as primary, and add "sln" as alias (#43607)
2 parents cf30ac2 + 528ec3d commit 41c6d4b

File tree

15 files changed

+544
-360
lines changed

15 files changed

+544
-360
lines changed

src/BuiltInTools/dotnet-watch/CommandLineOptions.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ internal sealed class CommandLineOptions
3434
"restore",
3535
"run",
3636
"sdk",
37-
"sln",
37+
"solution",
3838
"store",
3939
"test",
4040
"tool",
@@ -179,7 +179,7 @@ internal sealed class CommandLineOptions
179179
BuildProperties = ParseBuildProperties(parseResult.GetValue(propertyOption) ?? []).ToArray(),
180180
};
181181

182-
// Parses name=value pairs passed to --property. Skips invalid input.
182+
// Parses name=value pairs passed to --property. Skips invalid input.
183183
// We don't report error here as it will be reported by dotnet run.
184184
static IEnumerable<(string key, string value)> ParseBuildProperties(string[] properties)
185185
=> from property in properties
@@ -240,7 +240,7 @@ private static IReadOnlyList<string> GetCommandArguments(
240240
{
241241
explicitCommand = token;
242242
}
243-
else
243+
else
244244
{
245245
if (!dashDashInserted && i >= unmatchedTokensBeforeDashDash)
246246
{

src/Cli/dotnet-new3/Dotnet.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ internal static Dotnet AddProjectsToSolution(string solutionFile, IReadOnlyList<
7272
{
7373
List<string> allArgs = new()
7474
{
75-
"sln",
75+
"solution",
7676
solutionFile,
7777
"add"
7878
};

src/Cli/dotnet/ReleasePropertyProjectLocator.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ public IEnumerable<string> GetCustomDefaultConfigurationValueIfSpecified()
138138
}
139139
}
140140
}
141-
return null; // If nothing can be found: that's caught by MSBuild XMake::ProcessProjectSwitch -- don't change the behavior by failing here.
141+
return null; // If nothing can be found: that's caught by MSBuild XMake::ProcessProjectSwitch -- don't change the behavior by failing here.
142142
}
143143

144144
/// <returns>An arbitrary existant project in a solution file. Returns null if no projects exist.
@@ -205,7 +205,7 @@ public IEnumerable<string> GetCustomDefaultConfigurationValueIfSpecified()
205205
/// <summary>
206206
/// Returns an arbitrary project for the solution. Relies on the .NET SDK PrepareForPublish or _VerifyPackReleaseConfigurations MSBuild targets to catch conflicting values of a given property, like PublishRelease or PackRelease.
207207
/// </summary>
208-
/// <param name="sln">The solution to get an arbitrary project from.</param>
208+
/// <param name="solution">The solution to get an arbitrary project from.</param>
209209
/// <param name="globalProps">The global properties to load into the project.</param>
210210
/// <returns>null if no project exists in the solution that can be evaluated properly. Else, the first project in the solution that can be.</returns>
211211
private ProjectInstance? GetSingleProjectFromSolution(SlnFile sln, Dictionary<string, string> globalProps)
@@ -253,13 +253,13 @@ private bool IsUnanalyzableProjectInSolution(SlnProject project, string projectF
253253
return null;
254254
}
255255

256-
/// <returns>Returns true if the path exists and is a project file type.</returns>
256+
/// <returns>Returns true if the path exists and is a project file type.</returns>
257257
private bool IsValidProjectFilePath(string path)
258258
{
259259
return File.Exists(path) && Path.GetExtension(path).EndsWith("proj");
260260
}
261261

262-
/// <returns>Returns true if the path exists and is a sln file type.</returns>
262+
/// <returns>Returns true if the path exists and is a sln file type.</returns>
263263
private bool IsValidSlnFilePath(string path)
264264
{
265265
return File.Exists(path) && Path.GetExtension(path).EndsWith("sln");
@@ -271,7 +271,7 @@ private Dictionary<string, string> GetUserSpecifiedExplicitMSBuildProperties()
271271
Dictionary<string, string> globalProperties = new(StringComparer.OrdinalIgnoreCase);
272272

273273
string[]? globalPropEnumerable = _parseResult.GetValue(CommonOptions.PropertiesOption);
274-
274+
275275
if ( globalPropEnumerable != null )
276276
{
277277
foreach (var keyEqValString in globalPropEnumerable)

src/Cli/dotnet/Telemetry/TelemetryFilter.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ public IEnumerable<ApplicationInsightsEntryFormat> Filter(object objectToFilter)
8484
private static List<IParseResultLogRule> ParseResultLogRules => new()
8585
{
8686
new AllowListToSendFirstArgument(new HashSet<string> {"new", "help"}),
87-
new AllowListToSendFirstAppliedOptions(new HashSet<string> {"add", "remove", "list", "sln", "nuget"}),
87+
new AllowListToSendFirstAppliedOptions(new HashSet<string> {"add", "remove", "list", "solution", "nuget"}),
8888
new TopLevelCommandNameAndOptionToLog
8989
(
9090
topLevelCommandName: new HashSet<string> {"build", "publish"},

src/Cli/dotnet/commands/dotnet-help/HelpUsageText.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ internal static class HelpUsageText
5050
restore {LocalizableStrings.RestoreDefinition}
5151
run {LocalizableStrings.RunDefinition}
5252
sdk {LocalizableStrings.SdkDefinition}
53-
sln {LocalizableStrings.SlnDefinition}
53+
solution {LocalizableStrings.SlnDefinition}
5454
store {LocalizableStrings.StoreDefinition}
5555
test {LocalizableStrings.TestDefinition}
5656
tool {LocalizableStrings.ToolDefinition}

src/Cli/dotnet/commands/dotnet-new/DotnetCommandCallbacks.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ internal static bool AddProjectsToSolution(string solutionPath, IReadOnlyList<st
4646
{
4747
PathUtility.EnsureAllPathsExist(new[] { solutionPath }, CommonLocalizableStrings.FileNotFound, allowDirectories: false);
4848
PathUtility.EnsureAllPathsExist(projectsToAdd, CommonLocalizableStrings.FileNotFound, allowDirectories: false);
49-
IEnumerable<string> commandArgs = new[] { "sln", solutionPath, "add" }.Concat(projectsToAdd);
49+
IEnumerable<string> commandArgs = new[] { "solution", solutionPath, "add" }.Concat(projectsToAdd);
5050
if (!string.IsNullOrWhiteSpace(solutionFolder))
5151
{
5252
commandArgs = commandArgs.Append(SlnAddParser.SolutionFolderOption.Name).Append(solutionFolder);

src/Cli/dotnet/commands/dotnet-sln/SlnArgumentValidator.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public static void ParseAndValidateArguments(string _fileOrDirectory, IReadOnlyC
5252
{
5353
string.Format(CommonLocalizableStrings.SolutionArgumentMisplaced, slnFile),
5454
CommonLocalizableStrings.DidYouMean,
55-
$" dotnet sln {slnFile} {command} {args}{projectArgs}"
55+
$" dotnet solution {slnFile} {command} {args}{projectArgs}"
5656
});
5757
}
5858
}

src/Cli/dotnet/commands/dotnet-sln/SlnCommandParser.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// The .NET Foundation licenses this file to you under the MIT license.
33

44
using System.CommandLine;
5+
using NuGet.Packaging;
56
using LocalizableStrings = Microsoft.DotNet.Tools.Sln.LocalizableStrings;
67

78
namespace Microsoft.DotNet.Cli
@@ -10,6 +11,8 @@ internal static class SlnCommandParser
1011
{
1112
public static readonly string DocsLink = "https://aka.ms/dotnet-sln";
1213

14+
public static readonly string CommandName = "solution";
15+
public static readonly string CommandAlias = "sln";
1316
public static readonly CliArgument<string> SlnArgument = new CliArgument<string>(LocalizableStrings.SolutionArgumentName)
1417
{
1518
HelpName = LocalizableStrings.SolutionArgumentName,
@@ -26,7 +29,9 @@ public static CliCommand GetCommand()
2629

2730
private static CliCommand ConstructCommand()
2831
{
29-
DocumentedCommand command = new("sln", DocsLink, LocalizableStrings.AppFullName);
32+
DocumentedCommand command = new(CommandName, DocsLink, LocalizableStrings.AppFullName);
33+
34+
command.Aliases.Add(CommandAlias);
3035

3136
command.Arguments.Add(SlnArgument);
3237
command.Subcommands.Add(SlnAddParser.GetCommand());

test/dotnet-help.Tests/GivenThatIWantToShowHelpForDotnetCommand.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ remove Remove a package or reference from a .NET project.
5252
restore Restore dependencies specified in a .NET project.
5353
run Build and run a .NET project output.
5454
sdk Manage .NET SDK installation.
55-
sln Modify Visual Studio solution files.
55+
solution Modify Visual Studio solution files.
5656
store Store the specified assemblies in the runtime package store.
5757
test Run unit tests using the test runner specified in a .NET project.
5858
tool Install or manage tools that extend the .NET experience.

0 commit comments

Comments
 (0)