Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
15 changes: 6 additions & 9 deletions src/Cli/dotnet/Commands/CliCommandStrings.resx
Original file line number Diff line number Diff line change
Expand Up @@ -1780,16 +1780,13 @@ The default is to publish a framework-dependent application.</value>
<value>Couldn't find a project to run. Ensure a project exists in {0}, or pass the path to the project using {1}.</value>
</data>
<data name="RunCommandExceptionUnableToRun" xml:space="preserve">
<value>Unable to run your project.
Ensure you have a runnable project type and ensure '{0}' supports this project.
A runnable project should target a runnable TFM (for instance, net5.0) and have OutputType 'Exe'.
The current {1} is '{2}'.</value>
</data>
<data name="TestCommandExceptionUnableToRun" xml:space="preserve">
<value>Unable to proceed with project '{0}'.
Ensure you have a runnable project type and ensure '{1}' supports this project.
A runnable project should target a runnable TFM (for instance, net5.0) and have OutputType 'Exe'.
The current {2} is '{3}'.</value>
Ensure you have a runnable project type.
A runnable project should target a runnable TFM (for instance, {1}) and have OutputType 'Exe'.
The current OutputType is '{2}'.</value>
<comment>{0} is project file path.</comment>
<comment>{1} is dotnet framework version.</comment>
<comment>{2} is the project output type.</comment>
</data>
<data name="RunCommandExceptionUnableToRunSpecifyFramework" xml:space="preserve">
<value>Unable to run your project
Expand Down
4 changes: 2 additions & 2 deletions src/Cli/dotnet/Commands/Run/RunCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -511,8 +511,8 @@ internal static void ThrowUnableToRunError(ProjectInstance project)
throw new GracefulException(
string.Format(
CliCommandStrings.RunCommandExceptionUnableToRun,
"dotnet run",
"OutputType",
project.GetPropertyValue("MSBuildProjectFullPath"),
Product.TargetFrameworkVersion,
project.GetPropertyValue("OutputType")));
}

Expand Down
40 changes: 0 additions & 40 deletions src/Cli/dotnet/Commands/Run/RunProperties.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
// The .NET Foundation licenses this file to you under the MIT license.

using Microsoft.Build.Execution;
using Microsoft.DotNet.Cli.Commands.Test;
using Microsoft.DotNet.Cli.Utils;

namespace Microsoft.DotNet.Cli.Commands.Run;
Expand Down Expand Up @@ -47,43 +46,4 @@ internal RunProperties WithApplicationArguments(string[] applicationArgs)

return this;
}

internal static RunProperties GetPropsFromProject(ProjectInstance project)
{
var result = new RunProperties(
Command: project.GetPropertyValue("RunCommand"),
Arguments: project.GetPropertyValue("RunArguments"),
WorkingDirectory: project.GetPropertyValue("RunWorkingDirectory"),
RuntimeIdentifier: project.GetPropertyValue("RuntimeIdentifier"),
DefaultAppHostRuntimeIdentifier: project.GetPropertyValue("DefaultAppHostRuntimeIdentifier"),
TargetFrameworkVersion: project.GetPropertyValue("TargetFrameworkVersion"));

if (string.IsNullOrEmpty(result.Command))
{
ThrowUnableToRunError(project);
}

return result;
}

internal static void ThrowUnableToRunError(ProjectInstance project)
{
string targetFrameworks = project.GetPropertyValue("TargetFrameworks");
if (!string.IsNullOrEmpty(targetFrameworks))
{
string targetFramework = project.GetPropertyValue("TargetFramework");
if (string.IsNullOrEmpty(targetFramework))
{
throw new GracefulException(CliCommandStrings.RunCommandExceptionUnableToRunSpecifyFramework, "--framework");
}
}

throw new GracefulException(
string.Format(
CliCommandStrings.TestCommandExceptionUnableToRun,
project.GetPropertyValue(ProjectProperties.ProjectFullPath),
"dotnet test",
"OutputType",
project.GetPropertyValue("OutputType")));
}
}
11 changes: 5 additions & 6 deletions src/Cli/dotnet/Commands/Test/SolutionAndProjectUtility.cs
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ public static IEnumerable<ParallelizableTestModuleGroupWithSequentialInnerModule
}

string targetFramework = project.GetPropertyValue(ProjectProperties.TargetFramework);
string projectFullPath = project.GetPropertyValue(ProjectProperties.ProjectFullPath);
string projectFullPath = project.GetPropertyValue(ProjectProperties.ProjectFullPath);


// Only get run properties if IsTestingPlatformApplication is true
Expand All @@ -246,10 +246,9 @@ public static IEnumerable<ParallelizableTestModuleGroupWithSequentialInnerModule
{
throw new GracefulException(
string.Format(
CliCommandStrings.TestCommandExceptionUnableToRun,
projectFullPath,
"dotnet test",
"OutputType",
CliCommandStrings.RunCommandExceptionUnableToRun,
projectFullPath,
Product.TargetFrameworkVersion,
project.GetPropertyValue("OutputType")));
}
}
Expand Down Expand Up @@ -291,7 +290,7 @@ static RunProperties GetRunProperties(ProjectInstance project, ICollection<ILogg
}
}

return RunProperties.GetPropsFromProject(project);
return RunProperties.FromProject(project);
}
}

Expand Down
23 changes: 6 additions & 17 deletions src/Cli/dotnet/Commands/xlf/CliCommandStrings.cs.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 6 additions & 17 deletions src/Cli/dotnet/Commands/xlf/CliCommandStrings.de.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 6 additions & 17 deletions src/Cli/dotnet/Commands/xlf/CliCommandStrings.es.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 6 additions & 17 deletions src/Cli/dotnet/Commands/xlf/CliCommandStrings.fr.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 6 additions & 17 deletions src/Cli/dotnet/Commands/xlf/CliCommandStrings.it.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 6 additions & 17 deletions src/Cli/dotnet/Commands/xlf/CliCommandStrings.ja.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading