diff --git a/build/DependencyVersions.props b/build/DependencyVersions.props
index 7587a58653..a2b8bb4663 100644
--- a/build/DependencyVersions.props
+++ b/build/DependencyVersions.props
@@ -22,7 +22,7 @@
$(MicrosoftCodeAnalysisCSharpPackageVersion)$(MicrosoftCodeAnalysisCSharpPackageVersion)$(MicrosoftCodeAnalysisCSharpPackageVersion)
- 1.0.0-preview-62924-09
+ 2.1.400-preview-63010-01$(MicrosoftNETSdkPackageVersion)$(MicrosoftAspNetCoreAppPackageVersion)2.1.300
diff --git a/src/dotnet/Properties/AssemblyInfo.cs b/src/dotnet/Properties/AssemblyInfo.cs
index b5f0b8fe01..8b1c62cd5d 100644
--- a/src/dotnet/Properties/AssemblyInfo.cs
+++ b/src/dotnet/Properties/AssemblyInfo.cs
@@ -9,6 +9,7 @@
[assembly: InternalsVisibleTo("dotnet-add-package.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
[assembly: InternalsVisibleTo("dotnet-add-reference.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
[assembly: InternalsVisibleTo("dotnet-help.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
+[assembly: InternalsVisibleTo("dotnet-publish.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
[assembly: InternalsVisibleTo("dotnet-list-reference.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
[assembly: InternalsVisibleTo("dotnet-remove-reference.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
[assembly: InternalsVisibleTo("dotnet-remove-package.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
diff --git a/src/dotnet/commands/dotnet-publish/LocalizableStrings.resx b/src/dotnet/commands/dotnet-publish/LocalizableStrings.resx
index ebdf1fe0a5..59c01c3af3 100644
--- a/src/dotnet/commands/dotnet-publish/LocalizableStrings.resx
+++ b/src/dotnet/commands/dotnet-publish/LocalizableStrings.resx
@@ -135,9 +135,16 @@
The path to a target manifest file that contains the list of packages to be excluded from the publish step.
-
- Publish the .NET Core runtime with your application so the runtime doesn't need to be installed on the target machine.
-The default is 'true' if a runtime identifier is specified.
+
+ The mode to use when publishing the application.
+The 'self-contained' mode publishes the application with the .NET Core runtime.
+The 'fx-dependent' mode publishes the application as framework-dependent. If a target runtime is specified, it is published with an executable.
+The 'fx-dependent-no-exe' mode publishes the application as framework-dependent without an executable.
+The default is 'fx-dependent-no-exe' when a target runtime is not specified.
+The default is 'self-contained' when a target runtime is specified.
+
+
+ MODEDo not build the project before publishing. Implies --no-restore.
@@ -146,10 +153,16 @@ The default is 'true' if a runtime identifier is specified.
The target framework to publish for. The target framework has to be specified in the project file.
- The target runtime to publish for. This is used when creating self-contained deployment.
-The default is to publish a framework-dependent application.
+ The target runtime to publish the application for.
+The default is to publish a framework-dependent application without an executable.The configuration to publish for. The default for most projects is 'Debug'.
+
+ The '--mode' and '--self-contained' options cannot be used together. Specify only one of the options.
+
+
+ The specified publish mode '{0}' is not supported.
+
\ No newline at end of file
diff --git a/src/dotnet/commands/dotnet-publish/Program.cs b/src/dotnet/commands/dotnet-publish/Program.cs
index ed8f3260ce..631416b824 100644
--- a/src/dotnet/commands/dotnet-publish/Program.cs
+++ b/src/dotnet/commands/dotnet-publish/Program.cs
@@ -39,6 +39,37 @@ public static PublishCommand FromArgs(string[] args, string msbuildPath = null)
var appliedPublishOption = result["dotnet"]["publish"];
+ if (appliedPublishOption.HasOption("mode") && appliedPublishOption.HasOption("self-contained"))
+ {
+ throw new GracefulException(LocalizableStrings.PublishModeAndSelfContainedOptionsConflict);
+ }
+
+ var mode = appliedPublishOption.ValueOrDefault("mode");
+ switch (mode)
+ {
+ case null:
+ break;
+
+ case PublishCommandParser.SelfContainedMode:
+ msbuildArgs.Add("-p:SelfContained=true");
+ break;
+
+ case PublishCommandParser.FxDependentMode:
+ msbuildArgs.Add("-p:SelfContained=false");
+ break;
+
+ case PublishCommandParser.FxDependentNoExeMode:
+ msbuildArgs.Add("-p:SelfContained=false");
+ msbuildArgs.Add("-p:UseAppHost=false");
+ break;
+
+ default:
+ throw new GracefulException(
+ string.Format(
+ LocalizableStrings.UnsupportedPublishMode,
+ mode));
+ }
+
msbuildArgs.AddRange(appliedPublishOption.OptionValuesToBeForwarded());
msbuildArgs.AddRange(appliedPublishOption.Arguments);
diff --git a/src/dotnet/commands/dotnet-publish/PublishCommandParser.cs b/src/dotnet/commands/dotnet-publish/PublishCommandParser.cs
index 19ee3ec12b..96519680fd 100644
--- a/src/dotnet/commands/dotnet-publish/PublishCommandParser.cs
+++ b/src/dotnet/commands/dotnet-publish/PublishCommandParser.cs
@@ -10,6 +10,10 @@ namespace Microsoft.DotNet.Cli
{
internal static class PublishCommandParser
{
+ public const string SelfContainedMode = "self-contained";
+ public const string FxDependentMode = "fx-dependent";
+ public const string FxDependentNoExeMode = "fx-dependent-no-exe";
+
public static Command Publish() =>
CreateWithRestoreOptions.Command(
"publish",
@@ -40,7 +44,7 @@ public static Command Publish() =>
Accept.NoArguments().ForwardAs("-property:NoBuild=true")),
Create.Option(
"--self-contained",
- LocalizableStrings.SelfContainedOptionDescription,
+ "", // Hidden option for backwards-compatibility (now '--mode self-contained').
Accept.ZeroOrOneArgument()
.WithSuggestionsFrom("true", "false")
.ForwardAsSingle(o =>
@@ -48,6 +52,14 @@ public static Command Publish() =>
string value = o.Arguments.Any() ? o.Arguments.Single() : "true";
return $"-property:SelfContained={value}";
})),
+ Create.Option(
+ "--mode",
+ LocalizableStrings.ModeOptionDescription,
+ Accept.AnyOneOf(
+ SelfContainedMode,
+ FxDependentMode,
+ FxDependentNoExeMode)
+ .With(name: LocalizableStrings.ModeOptionName)),
CommonOptions.NoRestoreOption(),
CommonOptions.VerbosityOption());
}
diff --git a/src/dotnet/commands/dotnet-publish/xlf/LocalizableStrings.cs.xlf b/src/dotnet/commands/dotnet-publish/xlf/LocalizableStrings.cs.xlf
index fb4bc6d55b..65cdf77c08 100644
--- a/src/dotnet/commands/dotnet-publish/xlf/LocalizableStrings.cs.xlf
+++ b/src/dotnet/commands/dotnet-publish/xlf/LocalizableStrings.cs.xlf
@@ -37,22 +37,16 @@
Cesta k cílovému souboru manifestu obsahujícímu seznam balíčků, které se mají vyloučit z kroku publikování
-
- Publish the .NET Core runtime with your application so the runtime doesn't need to be installed on the target machine.
-The default is 'true' if a runtime identifier is specified.
- Publikuje spolu s aplikací modul runtime .NET Core, aby se tento modul nemusel instalovat na cílový počítač. Standardně se nastaví na True, pokud je zadaný identifikátor modulu runtime.
-
- Do not build the project before publishing. Implies --no-restore.Nesestavujte projekt, dokud ho nepublikujete. Implikuje možnost --no-restore.
- The target runtime to publish for. This is used when creating self-contained deployment.
-The default is to publish a framework-dependent application.
- The target runtime to publish for. This is used when creating self-contained deployment.
-The default is to publish a framework-dependent application.
+ The target runtime to publish the application for.
+The default is to publish a framework-dependent application without an executable.
+ The target runtime to publish the application for.
+The default is to publish a framework-dependent application without an executable.
@@ -60,6 +54,36 @@ The default is to publish a framework-dependent application.
The configuration to publish for. The default for most projects is 'Debug'.
+
+ The mode to use when publishing the application.
+The 'self-contained' mode publishes the application with the .NET Core runtime.
+The 'fx-dependent' mode publishes the application as framework-dependent. If a target runtime is specified, it is published with an executable.
+The 'fx-dependent-no-exe' mode publishes the application as framework-dependent without an executable.
+The default is 'fx-dependent-no-exe' when a target runtime is not specified.
+The default is 'self-contained' when a target runtime is specified.
+ The mode to use when publishing the application.
+The 'self-contained' mode publishes the application with the .NET Core runtime.
+The 'fx-dependent' mode publishes the application as framework-dependent. If a target runtime is specified, it is published with an executable.
+The 'fx-dependent-no-exe' mode publishes the application as framework-dependent without an executable.
+The default is 'fx-dependent-no-exe' when a target runtime is not specified.
+The default is 'self-contained' when a target runtime is specified.
+
+
+
+ MODE
+ MODE
+
+
+
+ The '--mode' and '--self-contained' options cannot be used together. Specify only one of the options.
+ The '--mode' and '--self-contained' options cannot be used together. Specify only one of the options.
+
+
+
+ The specified publish mode '{0}' is not supported.
+ The specified publish mode '{0}' is not supported.
+
+