diff --git a/src/dotnet/commands/dotnet-run/LocalizableStrings.resx b/src/dotnet/commands/dotnet-run/LocalizableStrings.resx
index e04e7c0045..964f633298 100644
--- a/src/dotnet/commands/dotnet-run/LocalizableStrings.resx
+++ b/src/dotnet/commands/dotnet-run/LocalizableStrings.resx
@@ -144,6 +144,12 @@
The target framework to run for. The target framework must also be specified in the project file.
+
+ The execution runtime to run the .NET application with.
+
+
+ RUNTIME
+
The build failed. Please fix the build errors and run again.
diff --git a/src/dotnet/commands/dotnet-run/RunCommand.cs b/src/dotnet/commands/dotnet-run/RunCommand.cs
index 307a2fff73..ed334007f8 100644
--- a/src/dotnet/commands/dotnet-run/RunCommand.cs
+++ b/src/dotnet/commands/dotnet-run/RunCommand.cs
@@ -31,6 +31,8 @@ public partial class RunCommand
public bool NoLaunchProfile { get; private set; }
private bool UseLaunchProfile => !NoLaunchProfile;
+ public string ExecutingRuntime { get; private set; }
+
public int Start()
{
Initialize();
@@ -69,6 +71,7 @@ public RunCommand(string configuration,
string launchProfile,
bool noLaunchProfile,
bool noRestore,
+ string executingRuntime,
IEnumerable restoreArgs,
IReadOnlyCollection args)
{
@@ -81,6 +84,7 @@ public RunCommand(string configuration,
Args = args;
RestoreArgs = restoreArgs;
NoRestore = noRestore;
+ ExecutingRuntime = executingRuntime;
}
public RunCommand MakeNewWithReplaced(string configuration = null,
@@ -90,6 +94,7 @@ public RunCommand MakeNewWithReplaced(string configuration = null,
string launchProfile = null,
bool? noLaunchProfile = null,
bool? noRestore = null,
+ string executingRuntime = null,
IEnumerable restoreArgs = null,
IReadOnlyCollection args = null)
{
@@ -101,6 +106,7 @@ public RunCommand MakeNewWithReplaced(string configuration = null,
launchProfile ?? this.LaunchProfile,
noLaunchProfile ?? this.NoLaunchProfile,
noRestore ?? this.NoRestore,
+ executingRuntime ?? this.ExecutingRuntime,
restoreArgs ?? this.RestoreArgs,
args ?? this.Args
);
@@ -200,6 +206,11 @@ private ICommand GetRunCommand()
globalProperties.Add("TargetFramework", Framework);
}
+ if (!string.IsNullOrWhiteSpace(ExecutingRuntime))
+ {
+ globalProperties.Add("ExecutingRuntime", ExecutingRuntime);
+ }
+
var project = new ProjectInstance(Project, globalProperties, null);
string runProgram = project.GetPropertyValue("RunCommand");
diff --git a/src/dotnet/commands/dotnet-run/RunCommandParser.cs b/src/dotnet/commands/dotnet-run/RunCommandParser.cs
index ea90555af1..849b2d5172 100644
--- a/src/dotnet/commands/dotnet-run/RunCommandParser.cs
+++ b/src/dotnet/commands/dotnet-run/RunCommandParser.cs
@@ -28,6 +28,7 @@ public static Command Run() =>
noLaunchProfile: o.HasOption("--no-launch-profile"),
noRestore: o.HasOption("--no-restore") || o.HasOption("--no-build"),
restoreArgs: o.OptionValuesToBeForwarded(),
+ executingRuntime: GetRuntimeName(o.SingleArgumentOrDefault("--clr")),
args: o.Arguments
)),
options: new[]
@@ -52,7 +53,24 @@ public static Command Run() =>
LocalizableStrings.CommandOptionNoBuildDescription,
Accept.NoArguments()),
CommonOptions.NoRestoreOption(),
- CommonOptions.VerbosityOption()
+ CommonOptions.VerbosityOption(),
+ Create.Option(
+ "--clr",
+ LocalizableStrings.CommandOptionCLRDescription,
+ Accept.AnyOneOf("coreclr", "mono").With(name: LocalizableStrings.CommandOptionCLRName))
});
+
+ static string GetRuntimeName(string option)
+ {
+ switch (option)
+ {
+ case "mono":
+ return "mono";
+ case "coreclr":
+ return "dotnet";
+ default:
+ return "";
+ }
+ }
}
}
\ No newline at end of file
diff --git a/src/dotnet/commands/dotnet-run/xlf/LocalizableStrings.cs.xlf b/src/dotnet/commands/dotnet-run/xlf/LocalizableStrings.cs.xlf
index a3bdbef06d..62719dd750 100644
--- a/src/dotnet/commands/dotnet-run/xlf/LocalizableStrings.cs.xlf
+++ b/src/dotnet/commands/dotnet-run/xlf/LocalizableStrings.cs.xlf
@@ -144,6 +144,14 @@ Aktuální {1} je {2}.
The target framework to run for. The target framework must also be specified in the project file.
+
+
+ The execution runtime to run the .NET application with.
+
+
+
+
+ RUNTIME