remove unused and incorrect localizations
This commit is contained in:
parent
a101c703a1
commit
43c9b363b0
16 changed files with 50 additions and 270 deletions
|
@ -48,6 +48,7 @@ namespace Microsoft.DotNet.Cli.Utils
|
|||
};
|
||||
|
||||
public static readonly string MSBUILD_EXE_PATH = "MSBUILD_EXE_PATH";
|
||||
public static readonly string MSBuildExtensionsPath = "MSBuildExtensionsPath";
|
||||
|
||||
public static readonly string ProjectArgumentName = "<PROJECT>";
|
||||
public static readonly string SolutionArgumentName = "<SLN_FILE>";
|
||||
|
|
|
@ -385,11 +385,11 @@ namespace Microsoft.DotNet.Cli.CommandLine
|
|||
if (cmd != this && cmd.Arguments.Any())
|
||||
{
|
||||
var args = string.Join(" ", cmd.Arguments.Select(arg => arg.Name));
|
||||
headerBuilder.Insert(usagePrefixLength, string.Format(LocalizableStrings.UsageItemWithArgs, cmd.Name, args));
|
||||
headerBuilder.Insert(usagePrefixLength, string.Format(" {0} {1}", cmd.Name, args));
|
||||
}
|
||||
else
|
||||
{
|
||||
headerBuilder.Insert(usagePrefixLength, string.Format(LocalizableStrings.UsageItemWithoutArgs, cmd.Name));
|
||||
headerBuilder.Insert(usagePrefixLength, string.Format(" {0}", cmd.Name));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -405,7 +405,7 @@ namespace Microsoft.DotNet.Cli.CommandLine
|
|||
|
||||
if (target != null)
|
||||
{
|
||||
headerBuilder.AppendFormat(LocalizableStrings.CommandItem, commandName);
|
||||
headerBuilder.AppendFormat(" {0}", commandName);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -444,11 +444,10 @@ namespace Microsoft.DotNet.Cli.CommandLine
|
|||
{
|
||||
if (cmd.Arguments.Any())
|
||||
{
|
||||
var outputFormat = LocalizableStrings.UsageArgumentItem;
|
||||
foreach (var arg in cmd.Arguments)
|
||||
{
|
||||
argumentsBuilder.AppendFormat(
|
||||
outputFormat,
|
||||
" {0}{1}",
|
||||
arg.Name.PadRight(maxArgLen + 2),
|
||||
arg.Description);
|
||||
argumentsBuilder.AppendLine();
|
||||
|
@ -463,7 +462,7 @@ namespace Microsoft.DotNet.Cli.CommandLine
|
|||
optionsBuilder.AppendLine();
|
||||
optionsBuilder.AppendLine(LocalizableStrings.UsageOptionsHeader);
|
||||
var maxOptLen = MaxOptionTemplateLength(target.Options);
|
||||
var outputFormat = string.Format(LocalizableStrings.UsageOptionsItem, maxOptLen + 2);
|
||||
var outputFormat = string.Format(" {{0, -{0}}}{{1}}", maxOptLen + 2);
|
||||
foreach (var opt in target.Options)
|
||||
{
|
||||
optionsBuilder.AppendFormat(outputFormat, opt.Template, opt.Description);
|
||||
|
@ -478,7 +477,7 @@ namespace Microsoft.DotNet.Cli.CommandLine
|
|||
commandsBuilder.AppendLine();
|
||||
commandsBuilder.AppendLine(LocalizableStrings.UsageCommandsHeader);
|
||||
var maxCmdLen = MaxCommandLength(target.Commands);
|
||||
var outputFormat = string.Format(LocalizableStrings.UsageCommandsItem, maxCmdLen + 2);
|
||||
var outputFormat = string.Format(" {{0, -{0}}}{{1}}", maxCmdLen + 2);
|
||||
foreach (var cmd in target.Commands.OrderBy(c => c.Name))
|
||||
{
|
||||
commandsBuilder.AppendFormat(outputFormat, cmd.Name, cmd.Description);
|
||||
|
@ -508,7 +507,7 @@ namespace Microsoft.DotNet.Cli.CommandLine
|
|||
{
|
||||
argumentSeparatorBuilder.AppendLine();
|
||||
argumentSeparatorBuilder.AppendLine(LocalizableStrings.UsageCommandsAdditionalArgsHeader);
|
||||
argumentSeparatorBuilder.AppendLine(String.Format(LocalizableStrings.UsageCommandsAdditionalArgsItem, target.ArgumentSeparatorHelpText));
|
||||
argumentSeparatorBuilder.AppendLine(String.Format(" {0}", target.ArgumentSeparatorHelpText));
|
||||
argumentSeparatorBuilder.AppendLine();
|
||||
}
|
||||
}
|
||||
|
@ -535,7 +534,7 @@ namespace Microsoft.DotNet.Cli.CommandLine
|
|||
|
||||
public string GetFullNameAndVersion()
|
||||
{
|
||||
return ShortVersionGetter == null ? FullName : string.Format(LocalizableStrings.ShortVersionTemplate, FullName, ShortVersionGetter());
|
||||
return ShortVersionGetter == null ? FullName : string.Format("{0} {1}", FullName, ShortVersionGetter());
|
||||
}
|
||||
|
||||
public void ShowRootCommandFullNameAndVersion()
|
||||
|
|
|
@ -20,28 +20,18 @@ namespace Microsoft.DotNet.Cli.CommandLine
|
|||
|
||||
public const string UsageHeader = "Usage:";
|
||||
|
||||
public const string UsageItemWithoutArgs = " {0}";
|
||||
|
||||
public const string UsageItemWithArgs = " {0} {1}";
|
||||
|
||||
public const string UsageArgumentsToken = " [arguments]";
|
||||
|
||||
public const string UsageArgumentsHeader = "Arguments:";
|
||||
|
||||
public const string UsageArgumentItem = " {0}{1}";
|
||||
|
||||
public const string UsageOptionsToken = " [options]";
|
||||
|
||||
public const string UsageOptionsHeader = "Options:";
|
||||
|
||||
public const string UsageOptionsItem = " {{0, -{0}}}{{1}}";
|
||||
|
||||
public const string UsageCommandToken = " [command]";
|
||||
|
||||
public const string UsageCommandsHeader = "Commands:";
|
||||
|
||||
public const string UsageCommandsItem = " {{0, -{0}}}{{1}}";
|
||||
|
||||
public const string UsageCommandsDetailHelp = "Use \"{0} [command] --help\" for more information about a command.";
|
||||
|
||||
public const string UsageCommandArgs = " [args]";
|
||||
|
@ -50,12 +40,6 @@ namespace Microsoft.DotNet.Cli.CommandLine
|
|||
|
||||
public const string UsageCommandsAdditionalArgsHeader = "Additional Arguments:";
|
||||
|
||||
public const string UsageCommandsAdditionalArgsItem = " {0}";
|
||||
|
||||
public const string CommandItem = " {0}";
|
||||
|
||||
public const string ShortVersionTemplate = "{0} {1}";
|
||||
|
||||
public const string InvalidTemplateError = "Invalid template pattern '{0}'";
|
||||
|
||||
public const string MSBuildAdditionalArgsHelpText = "Any extra options that should be passed to MSBuild. See 'dotnet msbuild -h' for available options.";
|
||||
|
|
|
@ -5,183 +5,65 @@ namespace Microsoft.DotNet.Tools
|
|||
{
|
||||
internal class CommonLocalizableStrings
|
||||
{
|
||||
public const string UnsupportedProjectType = "Unsupported project type. Please check with your sdk provider.";
|
||||
public const string ProjectAlreadyHasAreference = "Project already has a reference to `{0}`.";
|
||||
public const string ProjectReferenceCouldNotBeFound = "Project reference `{0}` could not be found.";
|
||||
public const string ProjectReferenceRemoved = "Project reference `{0}` removed.";
|
||||
|
||||
// Project related
|
||||
public const string Project = "Project";
|
||||
public const string ProjectFile = "Project file";
|
||||
public const string Reference = "Reference";
|
||||
public const string ProjectReference = "Project reference";
|
||||
public const string ProjectReferenceOneOrMore = "Project reference(s)";
|
||||
public const string PackageReference = "Package reference";
|
||||
public const string P2P = "Project to Project";
|
||||
public const string P2PReference = "Project to Project reference";
|
||||
public const string Package = "Package";
|
||||
public const string Solution = "Solution";
|
||||
public const string SolutionFile = "Solution file";
|
||||
public const string Executable = "Executable";
|
||||
public const string Library = "Library";
|
||||
public const string Program = "Program";
|
||||
public const string Application = "Application";
|
||||
public const string ReferenceAddedToTheProject = "Reference `{0}` added to the project.";
|
||||
|
||||
// Verbs
|
||||
public const string Add = "Add";
|
||||
public const string Remove = "Remove";
|
||||
public const string Delete = "Delete";
|
||||
public const string Update = "Update";
|
||||
public const string New = "New";
|
||||
public const string List = "List";
|
||||
public const string Load = "Load";
|
||||
public const string Save = "Save";
|
||||
public const string Find = "Find";
|
||||
|
||||
// Other
|
||||
public const string Error = "Error";
|
||||
public const string Warning = "Warning";
|
||||
|
||||
public const string File = "File";
|
||||
public const string Directory = "Directory";
|
||||
|
||||
public const string Type = "Type";
|
||||
public const string Value = "Value";
|
||||
public const string Group = "Group";
|
||||
|
||||
// General sentences";
|
||||
public const string XAddedToY = "{0} added to {1}.";
|
||||
public const string XRemovedFromY = "{0} removed from {1}.";
|
||||
public const string XDeletedFromY = "{0} deleted from {1}.";
|
||||
public const string XSuccessfullyUpdated = "{0} successfully updated.";
|
||||
|
||||
// General errors
|
||||
/// Invalid
|
||||
public const string XIsInvalid = "{0} is invalid.";
|
||||
public const string XYFoundButInvalid = "{0} `{1}` found but is invalid.";
|
||||
public const string XFoundButInvalid = "`{0}` found but is invalid.";
|
||||
public const string OperationInvalid = "Operation is invalid.";
|
||||
public const string OperationXInvalid = "Operation {0} is invalid.";
|
||||
|
||||
/// Not Found
|
||||
public const string XNotFound = "{0} not found.";
|
||||
public const string XOrYNotFound = "{0} or {1} not found.";
|
||||
public const string XOrYNotFoundInZ = "{0} or {1} not found in `{2}`.";
|
||||
public const string FileNotFound = "File `{0}` not found.";
|
||||
|
||||
/// Does not exist
|
||||
public const string XDoesNotExist = "{0} does not exist.";
|
||||
public const string XYDoesNotExist = "{0} `{1}` does not exist.";
|
||||
|
||||
/// Duplicate
|
||||
public const string MoreThanOneXFound = "More than one {0} found.";
|
||||
public const string XAlreadyContainsY = "{0} already contains {1}.";
|
||||
public const string XAlreadyContainsYZ = "{0} already contains {1} `{2}`.";
|
||||
public const string XAlreadyHasY = "{0} already has {1}.";
|
||||
public const string XAlreadyHasYZ = "{0} already has {1} `{2}`.";
|
||||
|
||||
/// Other
|
||||
public const string XWasNotExpected = "{0} was not expected.";
|
||||
public const string XNotProvided = "{0} not provided.";
|
||||
public const string SpecifyAtLeastOne = "Please specify at least one {0}.";
|
||||
public const string CouldNotConnectWithTheServer = "Could not connect with the server.";
|
||||
|
||||
// Command Line Parsing
|
||||
public const string RequiredArgumentIsInvalid = "Required argument {0} is invalid.";
|
||||
public const string OptionIsInvalid = "Option {0} is invalid.";
|
||||
public const string ArgumentIsInvalid = "Argument {0} is invalid.";
|
||||
public const string RequiredArgumentNotPassed = "Required argument {0} was not provided.";
|
||||
public const string RequiredCommandNotPassed = "Required command was not provided.";
|
||||
|
||||
// dotnet <verb>
|
||||
/// Project
|
||||
public const string CouldNotFindAnyProjectInDirectory = "Could not find any project in `{0}`.";
|
||||
|
||||
public const string CouldNotFindProjectOrDirectory = "Could not find project or directory `{0}`.";
|
||||
public const string MoreThanOneProjectInDirectory = "Found more than one project in `{0}`. Please specify which one to use.";
|
||||
public const string FoundInvalidProject = "Found a project `{0}` but it is invalid.";
|
||||
public const string InvalidProject = "Invalid project `{0}`.";
|
||||
private const string InvalidProject = "Invalid project `{0}`.";
|
||||
|
||||
/// Solution
|
||||
public const string CouldNotFindSolutionIn = "Specified solution file {0} does not exist, or there is no solution file in the directory.";
|
||||
|
||||
public const string CouldNotFindSolutionOrDirectory = "Could not find solution or directory `{0}`.";
|
||||
public const string MoreThanOneSolutionInDirectory = "Found more than one solution file in {0}. Please specify which one to use.";
|
||||
public const string InvalidSolutionFormatString = "Invalid solution `{0}`. {1}"; // {0} is the solution path, {1} is already localized details on the failure
|
||||
public const string SolutionDoesNotExist = "Specified solution file {0} does not exist, or there is no solution file in the directory.";
|
||||
|
||||
/// add p2p
|
||||
public const string ReferenceDoesNotExist = "Reference {0} does not exist.";
|
||||
public const string ReferenceIsInvalid = "Reference `{0}` is invalid.";
|
||||
public const string SpecifyAtLeastOneReferenceToAdd = "You must specify at least one reference to add.";
|
||||
public const string ProjectAlreadyHasAReference = "Project {0} already has a reference `{1}`.";
|
||||
|
||||
/// add package
|
||||
public const string PackageReferenceDoesNotExist = "Package reference `{0}` does not exist.";
|
||||
public const string PackageReferenceIsInvalid = "Package reference `{0}` is invalid.";
|
||||
public const string SpecifyAtLeastOnePackageReferenceToAdd = "You must specify at least one package to add.";
|
||||
public const string PackageReferenceAddedToTheProject = "Package reference `{0}` added to the project.";
|
||||
public const string ProjectAlreadyHasAPackageReference = "Project {0} already has a reference `{1}`.";
|
||||
public const string PleaseSpecifyVersion = "Please specify a version of the package.";
|
||||
|
||||
/// add sln
|
||||
public const string ProjectDoesNotExist = "Project `{0}` does not exist.";
|
||||
|
||||
public const string ProjectIsInvalid = "Project `{0}` is invalid.";
|
||||
public const string SpecifyAtLeastOneProjectToAdd = "You must specify at least one project to add.";
|
||||
public const string ProjectAddedToTheSolution = "Project `{0}` added to the solution.";
|
||||
public const string SolutionAlreadyContainsProject = "Solution {0} already contains project {1}.";
|
||||
|
||||
/// del p2p
|
||||
public const string ReferenceNotFoundInTheProject = "Specified reference {0} does not exist in project {1}.";
|
||||
public const string ReferenceRemoved = "Reference `{0}` deleted from the project.";
|
||||
public const string SpecifyAtLeastOneReferenceToRemove = "You must specify at least one reference to remove.";
|
||||
public const string ReferenceDeleted = "Reference `{0}` deleted.";
|
||||
|
||||
/// del pkg
|
||||
public const string PackageReferenceNotFoundInTheProject = "Package reference `{0}` could not be found in the project.";
|
||||
public const string PackageReferenceRemoved = "Reference `{0}` deleted from the project.";
|
||||
public const string SpecifyAtLeastOnePackageReferenceToRemove = "You must specify at least one package reference to remove.";
|
||||
public const string PackageReferenceDeleted = "Package reference `{0}` deleted.";
|
||||
|
||||
/// del sln
|
||||
public const string ProjectNotFoundInTheSolution = "Project `{0}` could not be found in the solution.";
|
||||
public const string ProjectRemoved = "Project `{0}` removed from solution.";
|
||||
public const string SpecifyAtLeastOneProjectToRemove = "You must specify at least one project to remove.";
|
||||
public const string ProjectDeleted = "Project `{0}` deleted from solution.";
|
||||
|
||||
/// list
|
||||
public const string NoReferencesFound = "There are no {0} references in project {1}. ;; {0} is the type of the item being requested (project, package, p2p) and {1} is the object operated on (a project file or a solution file). ";
|
||||
public const string NoProjectsFound = "No projects found in the solution.";
|
||||
|
||||
/// arguments
|
||||
public const string ArgumentsProjectOrSolutionDescription = "The project or solution to operation on. If a file is not specified, the current directory is searched.";
|
||||
public const string NoProjectsFound = "No projects found in the solution.";
|
||||
|
||||
/// sln
|
||||
public const string ArgumentsProjectDescription = "The project file to operate on. If a file is not specified, the command will search the current directory for one.";
|
||||
|
||||
public const string ArgumentsSolutionDescription = "Solution file to operate on. If not specified, the command will search the current directory for one.";
|
||||
public const string CmdSlnFile = "<SLN_FILE>";
|
||||
public const string CmdProjectFile = "<PROJECT>";
|
||||
|
||||
/// commands
|
||||
public const string CmdFramework = "FRAMEWORK";
|
||||
|
||||
/// update pkg
|
||||
public const string PleaseSpecifyNewVersion = "Please specify new version of the package.";
|
||||
public const string PleaseSpecifyWhichPackageToUpdate = "Please specify which package to update.";
|
||||
public const string NothingToUpdate = "Nothing to update.";
|
||||
public const string EverythingUpToDate = "Everything is already up-to-date.";
|
||||
public const string PackageVersionUpdatedTo = "Version of package `{0}` updated to `{1}`.";
|
||||
public const string PackageVersionUpdated = "Version of package `{0}` updated.";
|
||||
public const string CouldNotUpdateTheVersion = "Could not update the version of the package `{0}`.";
|
||||
|
||||
/// new
|
||||
public const string TemplateCreatedSuccessfully = "The template {0} created successfully. Please run \"dotnet restore\" to get started!";
|
||||
public const string TemplateInstalledSuccesfully = "The template {0} installed successfully. You can use \"dotnet new {0}\" to get started with the new template.";
|
||||
public const string TemplateCreateError = "Template {0} could not be created. Error returned was: {1}.";
|
||||
public const string TemplateInstallError = "Template {0} could not be installed. Error returned was: {1}.";
|
||||
public const string SpecifiedNameExists = "Specified name {0} already exists. Please specify a different name.";
|
||||
public const string SpecifiedAliasExists = "Specified alias {0} already exists. Please specify a different alias.";
|
||||
public const string MandatoryParameterMissing = "Mandatory parameter {0} missing for template {1}. ";
|
||||
|
||||
public const string ProjectNotCompatibleWithFrameworks = "Project `{0}` cannot be added due to incompatible targeted frameworks between the two projects. Please review the project you are trying to add and verify that is compatible with the following targets:";
|
||||
public const string ProjectDoesNotTargetFramework = "Project `{0}` does not target framework `{1}`.";
|
||||
public const string ProjectCouldNotBeEvaluated = "Project `{0}` could not be evaluated. Evaluation failed with following error:\n{1}";
|
||||
|
|
|
@ -46,8 +46,8 @@ namespace Microsoft.DotNet.Tools.Add.PackageReference
|
|||
|
||||
command._versionOption = command.Option(
|
||||
$"-v|--version <{LocalizableStrings.CmdVersion}>",
|
||||
LocalizableStrings.CmdVersionDescription,
|
||||
CommandOptionType.SingleValue);
|
||||
description: LocalizableStrings.CmdVersionDescription,
|
||||
optionType: CommandOptionType.SingleValue);
|
||||
|
||||
command._frameworkOption = command.Option(
|
||||
$"-f|--framework <{LocalizableStrings.CmdFramework}>",
|
||||
|
|
|
@ -1,14 +0,0 @@
|
|||
// Copyright (c) .NET Foundation and contributors. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
|
||||
namespace Microsoft.DotNet.Tools.Add.ProjectToSolution
|
||||
{
|
||||
internal class LocalizableStrings
|
||||
{
|
||||
public const string AppFullName = ".NET Add Project to Solution Command";
|
||||
|
||||
public const string AppDescription = "Command to add project to solution";
|
||||
|
||||
public const string AppHelpText = "Projects to add to solution";
|
||||
}
|
||||
}
|
|
@ -46,12 +46,6 @@
|
|||
|
||||
public const string MigrateDefinition = "Migrates a project.json based project to a msbuild based project.";
|
||||
|
||||
public const string ProjectModificationCommands = "Project modification commands";
|
||||
|
||||
public const string AddDefinition = "Add items to the project.";
|
||||
|
||||
public const string RemoveDefinition = "Remove items from the project.";
|
||||
|
||||
public const string AdvancedCommands = "Advanced Commands";
|
||||
|
||||
public const string NugetDefinition = "Provides additional NuGet commands.";
|
||||
|
|
|
@ -1,12 +0,0 @@
|
|||
// Copyright (c) .NET Foundation and contributors. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
|
||||
namespace Microsoft.DotNet.Tools.List.ProjectsInSolution
|
||||
{
|
||||
internal class LocalizableStrings
|
||||
{
|
||||
public const string AppFullName = ".NET Projects in Solution viewer";
|
||||
|
||||
public const string AppDescription = "Command to list projects in a solution";
|
||||
}
|
||||
}
|
|
@ -8,7 +8,5 @@ namespace Microsoft.DotNet.Tools.List.ProjectToProjectReferences
|
|||
public const string AppFullName = ".NET Core Project-to-Project dependency viewer";
|
||||
|
||||
public const string AppDescription = "Command to list project to project references";
|
||||
|
||||
public const string NoReferencesFound = "There are no {0} references in project {1}.\n{0} is the type of the item being requested (project, package, p2p) and {1} is the object operated on (a project file or a solution file). ";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,14 +0,0 @@
|
|||
// Copyright (c) .NET Foundation and contributors. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
|
||||
namespace Microsoft.DotNet.Tools.Remove.ProjectFromSolution
|
||||
{
|
||||
internal class LocalizableStrings
|
||||
{
|
||||
public const string AppFullName = ".NET Remove Project from Solution Command";
|
||||
|
||||
public const string AppDescription = "Command to remove projects from a solution";
|
||||
|
||||
public const string AppHelpText = "Projects to remove from a solution";
|
||||
}
|
||||
}
|
|
@ -1,9 +0,0 @@
|
|||
namespace Microsoft.DotNet.Tools.RestoreProjectJson
|
||||
{
|
||||
internal class LocalizableStrings
|
||||
{
|
||||
public const string AddMinimal = "minimal";
|
||||
|
||||
public const string AddRestore = "restore";
|
||||
}
|
||||
}
|
|
@ -1,7 +1,6 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Microsoft.DotNet.Tools;
|
||||
|
||||
namespace Microsoft.DotNet.Tools.RestoreProjectJson
|
||||
{
|
||||
|
@ -13,9 +12,9 @@ namespace Microsoft.DotNet.Tools.RestoreProjectJson
|
|||
if (!args.Any(s => s.Equals("--verbosity", StringComparison.OrdinalIgnoreCase) || s.Equals("-v", StringComparison.OrdinalIgnoreCase)))
|
||||
{
|
||||
prefixArgs.Add("--verbosity");
|
||||
prefixArgs.Add(LocalizableStrings.AddMinimal);
|
||||
prefixArgs.Add("minimal");
|
||||
}
|
||||
prefixArgs.Add(LocalizableStrings.AddRestore);
|
||||
prefixArgs.Add("restore");
|
||||
|
||||
var nugetApp = new NuGetForwardingApp(Enumerable.Concat(prefixArgs, args));
|
||||
|
||||
|
|
|
@ -16,33 +16,7 @@
|
|||
|
||||
public const string RunCommandException = "The build failed. Please fix the build errors and run again.";
|
||||
|
||||
public const string RunCommandMSBuildExtensionsPath = "MSBuildExtensionsPath";
|
||||
|
||||
public const string RunCommandConfiguration = "Configuration";
|
||||
|
||||
public const string RunCommandTargetFramework = "TargetFramework";
|
||||
|
||||
public const string RunCommandProjectInstance = "RunCommand";
|
||||
|
||||
public const string RunCommandOutputType = "OutputType";
|
||||
|
||||
public const string RunCommandExceptionUnableToRun1 = "Unable to run your project.";
|
||||
|
||||
public const string RunCommandExceptionUnableToRun2 = "Please ensure you have a runnable project type and ensure 'dotnet run' supports this project.";
|
||||
|
||||
public const string RunCommandExceptionUnableToRun3 = "The current OutputType is ";
|
||||
|
||||
public const string RunCommandRunArguments = "RunArguments";
|
||||
|
||||
public const string RunCommandRunWorkingDirectory = "RunWorkingDirectory";
|
||||
|
||||
public const string RunCommandInvalidOperationException1 = "Couldn't find a project to run. Ensure a project exists in ";
|
||||
|
||||
public const string RunCommandInvalidOperationException2 = "Or pass the path to the project using --project";
|
||||
|
||||
public const string RunCommandInvalidOperationException3 = "Specify which project file to use because this ";
|
||||
|
||||
public const string RunCommandInvalidOperationException4 = "contains more than one project file.";
|
||||
public const string RunCommandExceptionUnableToRun = "Unable to run your project\nPlease ensure you have a runnable project type and ensure '{0}' supports this project.\nThe current {1} is '{2}'";
|
||||
|
||||
public const string RunCommandAdditionalArgsHelpText = "Arguments passed to the application that is being run.";
|
||||
}
|
||||
|
|
|
@ -67,36 +67,38 @@ namespace Microsoft.DotNet.Tools.Run
|
|||
|
||||
private ICommand GetRunCommand()
|
||||
{
|
||||
Dictionary<string, string> globalProperties = new Dictionary<string, string>()
|
||||
var globalProperties = new Dictionary<string, string>
|
||||
{
|
||||
{ LocalizableStrings.RunCommandMSBuildExtensionsPath, AppContext.BaseDirectory }
|
||||
{ Constants.MSBuildExtensionsPath, AppContext.BaseDirectory }
|
||||
};
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(Configuration))
|
||||
{
|
||||
globalProperties.Add(LocalizableStrings.RunCommandConfiguration, Configuration);
|
||||
globalProperties.Add("Configuration", Configuration);
|
||||
}
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(Framework))
|
||||
{
|
||||
globalProperties.Add(LocalizableStrings.RunCommandTargetFramework, Framework);
|
||||
globalProperties.Add("TargetFramework", Framework);
|
||||
}
|
||||
|
||||
ProjectInstance projectInstance = new ProjectInstance(Project, globalProperties, null);
|
||||
|
||||
string runProgram = projectInstance.GetPropertyValue(LocalizableStrings.RunCommandProjectInstance);
|
||||
string runProgram = projectInstance.GetPropertyValue("RunCommand");
|
||||
if (string.IsNullOrEmpty(runProgram))
|
||||
{
|
||||
string outputType = projectInstance.GetPropertyValue(LocalizableStrings.RunCommandOutputType);
|
||||
string outputType = projectInstance.GetPropertyValue("OutputType");
|
||||
|
||||
throw new GracefulException(string.Join(Environment.NewLine,
|
||||
LocalizableStrings.RunCommandExceptionUnableToRun1,
|
||||
LocalizableStrings.RunCommandExceptionUnableToRun2,
|
||||
$"{LocalizableStrings.RunCommandExceptionUnableToRun3}'{outputType}'."));
|
||||
throw new GracefulException(
|
||||
string.Format(
|
||||
LocalizableStrings.RunCommandExceptionUnableToRun,
|
||||
"dotnet run",
|
||||
"OutputType",
|
||||
outputType));
|
||||
}
|
||||
|
||||
string runArguments = projectInstance.GetPropertyValue(LocalizableStrings.RunCommandRunArguments);
|
||||
string runWorkingDirectory = projectInstance.GetPropertyValue(LocalizableStrings.RunCommandRunWorkingDirectory);
|
||||
string runArguments = projectInstance.GetPropertyValue("RunArguments");
|
||||
string runWorkingDirectory = projectInstance.GetPropertyValue("RunWorkingDirectory");
|
||||
|
||||
string fullArguments = runArguments;
|
||||
if (_args.Any())
|
||||
|
@ -119,15 +121,16 @@ namespace Microsoft.DotNet.Tools.Run
|
|||
|
||||
if (projectFiles.Length == 0)
|
||||
{
|
||||
var project = "--project";
|
||||
|
||||
throw new InvalidOperationException(
|
||||
$"{LocalizableStrings.RunCommandInvalidOperationException1} {directory}." + Environment.NewLine +
|
||||
LocalizableStrings.RunCommandInvalidOperationException2)
|
||||
$"Couldn\'t find a project to run. Ensure a project exists in {directory}, or pass the path to the project using {project}")
|
||||
.DisplayAsError();
|
||||
}
|
||||
else if (projectFiles.Length > 1)
|
||||
{
|
||||
throw new InvalidOperationException(
|
||||
$"{LocalizableStrings.RunCommandInvalidOperationException3}'{directory}'{LocalizableStrings.RunCommandInvalidOperationException4}")
|
||||
$"Specify which project file to use because {directory} contains more than one project file.")
|
||||
.DisplayAsError();
|
||||
}
|
||||
|
||||
|
|
|
@ -7,21 +7,16 @@ namespace Microsoft.DotNet.Tools.Sln
|
|||
{
|
||||
public const string AppFullName = ".NET modify solution file command";
|
||||
|
||||
public const string AppDescription = "Command to add, remove, and list projects from the solution (SLN) file.";
|
||||
|
||||
public const string AppHelpText = "Projects to add or to remove from the solution.";
|
||||
|
||||
public const string AddAppFullName = ".NET Add project(s) to a solution file Command";
|
||||
public const string AddSubcommandHelpText = "Add a specified project(s) to the solution.";
|
||||
|
||||
public const string AddSubcommandHelpText = "Add one or more specified project(s) to the solution.";
|
||||
|
||||
public const string RemoveAppFullName = ".NET Remove project(s) from a solution file Command";
|
||||
|
||||
public const string RemoveSubcommandHelpText = "Remove the specified project(s) from the solution. The project is not impacted.";
|
||||
|
||||
public const string ListAppFullName = ".NET List project(s) in a solution file Command";
|
||||
|
||||
public const string ListSubcommandHelpText = "List all projects in the solution.";
|
||||
|
||||
public const string CreateAppFullName = ".NET Create a solution file Command";
|
||||
public const string CreateSubcommandHelpText = "Create a solution file.";
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
public const string CmdArgProject = "PROJECT";
|
||||
|
||||
public const string CmdArgDescription = "The project to test, defaults to the current directory.";
|
||||
public const string CmdArgDescription = "The project to test. Defaults to the current directory.";
|
||||
|
||||
public const string CmdSettingsFile = "SETTINGS_FILE";
|
||||
|
||||
|
|
Loading…
Reference in a new issue