From bc96902c6131ad179d2b928bd9278109a7ee271b Mon Sep 17 00:00:00 2001 From: Peter Huene Date: Thu, 31 May 2018 21:19:21 -0700 Subject: [PATCH 1/3] Implement `mode` option for `dotnet publish`. This commit implements a `mode` option that can control how an application is published with the `dotnet publish` command. There are three supported modes: * self-contained: publishes a self-contained application (same as --self-contained). * fx-dependent: publishes a framework-dependent application (with an application host when a runtime is specified). * fx-dependent-no-exe: publishes a framework-dependent application without an application host. The default when publishing without a runtime specified is `fx-dependent-no-exe`. The default when publishing with a runtime specified is `self-contained`. `fx-dependent` requires netcoreapp2.1 or later when a runtime is specified. The `--self-contained` option is still supported, but is now hidden so that users will be encouraged to move to the `--mode` option. Fixes #6237. --- build/DependencyVersions.props | 2 +- src/dotnet/Properties/AssemblyInfo.cs | 1 + .../dotnet-publish/LocalizableStrings.resx | 23 +++- src/dotnet/commands/dotnet-publish/Program.cs | 31 +++++ .../dotnet-publish/PublishCommandParser.cs | 14 ++- .../xlf/LocalizableStrings.cs.xlf | 44 +++++-- .../xlf/LocalizableStrings.de.xlf | 44 +++++-- .../xlf/LocalizableStrings.es.xlf | 44 +++++-- .../xlf/LocalizableStrings.fr.xlf | 44 +++++-- .../xlf/LocalizableStrings.it.xlf | 44 +++++-- .../xlf/LocalizableStrings.ja.xlf | 44 +++++-- .../xlf/LocalizableStrings.ko.xlf | 44 +++++-- .../xlf/LocalizableStrings.pl.xlf | 44 +++++-- .../xlf/LocalizableStrings.pt-BR.xlf | 44 +++++-- .../xlf/LocalizableStrings.ru.xlf | 44 +++++-- .../xlf/LocalizableStrings.tr.xlf | 44 +++++-- .../xlf/LocalizableStrings.zh-Hans.xlf | 44 +++++-- .../xlf/LocalizableStrings.zh-Hant.xlf | 44 +++++-- .../Commands/PublishCommand.cs | 10 +- .../GivenDotnetPublishPublishesProjects.cs | 118 +++++++++++------- .../dotnet-publish.Tests.csproj | 4 + 21 files changed, 587 insertions(+), 188 deletions(-) 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..6a11341d8f 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 with an executable if a target runtime is specified. +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 Do 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 conflict. 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..d8802bc579 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 with an executable if a target runtime is specified. +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 with an executable if a target runtime is specified. +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 conflict. Specify only one of the options. + The '--mode' and '--self-contained' options conflict. Specify only one of the options. + + + + The specified publish mode '{0}' is not supported. + The specified publish mode '{0}' is not supported. + + \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-publish/xlf/LocalizableStrings.de.xlf b/src/dotnet/commands/dotnet-publish/xlf/LocalizableStrings.de.xlf index 60b8b2a502..e26d57f71d 100644 --- a/src/dotnet/commands/dotnet-publish/xlf/LocalizableStrings.de.xlf +++ b/src/dotnet/commands/dotnet-publish/xlf/LocalizableStrings.de.xlf @@ -37,22 +37,16 @@ Der Pfad zu einer Zielmanifestdatei, die die Liste der von der Veröffentlichung auszuschließenden Pakete enthält. - - 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. - Veröffentlichen Sie die .NET Core-Runtime mit Ihrer Anwendung, damit die Runtime auf dem Zielcomputer nicht installiert werden muss. Der Standardwert ist "true", wenn ein Runtimebezeichner angegeben ist. - - Do not build the project before publishing. Implies --no-restore. Erstellt das Projekt nicht vor dem Veröffentlichen. Impliziert "--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 with an executable if a target runtime is specified. +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 with an executable if a target runtime is specified. +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 conflict. Specify only one of the options. + The '--mode' and '--self-contained' options conflict. Specify only one of the options. + + + + The specified publish mode '{0}' is not supported. + The specified publish mode '{0}' is not supported. + + \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-publish/xlf/LocalizableStrings.es.xlf b/src/dotnet/commands/dotnet-publish/xlf/LocalizableStrings.es.xlf index 3e18e4ab90..baa3744c32 100644 --- a/src/dotnet/commands/dotnet-publish/xlf/LocalizableStrings.es.xlf +++ b/src/dotnet/commands/dotnet-publish/xlf/LocalizableStrings.es.xlf @@ -37,22 +37,16 @@ La ruta de acceso a un archivo de manifiesto de destino que contiene la lista de paquetes que se excluirán del paso de publicació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. - Publica el tiempo de ejecución de .NET Core con su aplicación para que no sea necesario instalarlo en la máquina de destino. Si se especifica un identificador de tiempo de ejecución, se toma como predeterminado el valor "true". - - Do not build the project before publishing. Implies --no-restore. No compile el proyecto antes de publicarlo. Implica --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 with an executable if a target runtime is specified. +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 with an executable if a target runtime is specified. +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 conflict. Specify only one of the options. + The '--mode' and '--self-contained' options conflict. Specify only one of the options. + + + + The specified publish mode '{0}' is not supported. + The specified publish mode '{0}' is not supported. + + \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-publish/xlf/LocalizableStrings.fr.xlf b/src/dotnet/commands/dotnet-publish/xlf/LocalizableStrings.fr.xlf index b80796a492..73ab78be8c 100644 --- a/src/dotnet/commands/dotnet-publish/xlf/LocalizableStrings.fr.xlf +++ b/src/dotnet/commands/dotnet-publish/xlf/LocalizableStrings.fr.xlf @@ -37,22 +37,16 @@ Chemin d'un fichier manifeste cible contenant la liste des packages à exclure de l'étape de publication. - - 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. - Publiez le runtime .NET Core avec votre application pour éviter à l'utilisateur de l'installer sur la machine cible. La valeur par défaut est 'true' si un identificateur de runtime est spécifié. - - Do not build the project before publishing. Implies --no-restore. Ne pas générer le projet avant la publication. Implique --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 with an executable if a target runtime is specified. +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 with an executable if a target runtime is specified. +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 conflict. Specify only one of the options. + The '--mode' and '--self-contained' options conflict. Specify only one of the options. + + + + The specified publish mode '{0}' is not supported. + The specified publish mode '{0}' is not supported. + + \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-publish/xlf/LocalizableStrings.it.xlf b/src/dotnet/commands/dotnet-publish/xlf/LocalizableStrings.it.xlf index 70e1cde814..fd9e38f7ac 100644 --- a/src/dotnet/commands/dotnet-publish/xlf/LocalizableStrings.it.xlf +++ b/src/dotnet/commands/dotnet-publish/xlf/LocalizableStrings.it.xlf @@ -37,22 +37,16 @@ Percorso di un file manifesto di destinazione che contiene l'elenco di pacchetti da escludere dal passaggio di pubblicazione. - - 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. - Pubblica il runtime di .NET Core con l'applicazione in modo che non sia necessario installarlo nel computer di destinazione. Se si specifica un identificatore di runtime, l'impostazione predefinita è 'true'. - - Do not build the project before publishing. Implies --no-restore. Non compila il progetto prima della pubblicazione. Implica --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 with an executable if a target runtime is specified. +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 with an executable if a target runtime is specified. +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 conflict. Specify only one of the options. + The '--mode' and '--self-contained' options conflict. Specify only one of the options. + + + + The specified publish mode '{0}' is not supported. + The specified publish mode '{0}' is not supported. + + \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-publish/xlf/LocalizableStrings.ja.xlf b/src/dotnet/commands/dotnet-publish/xlf/LocalizableStrings.ja.xlf index 66e3fb513d..89904c4769 100644 --- a/src/dotnet/commands/dotnet-publish/xlf/LocalizableStrings.ja.xlf +++ b/src/dotnet/commands/dotnet-publish/xlf/LocalizableStrings.ja.xlf @@ -37,22 +37,16 @@ 発行ステップから除外されるパッケージのリストを含むターゲット マニフェスト ファイルへのパス。 - - 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. - ランタイムをターゲット マシンにインストールしなくてもよいよう、.NET Core ランタイムをアプリケーションと一緒に発行します。ランタイム ID が指定される場合、既定の 'true' になります。 - - Do not build the project before publishing. Implies --no-restore. 発行する前にプロジェクトをビルドしないでください。--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 with an executable if a target runtime is specified. +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 with an executable if a target runtime is specified. +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 conflict. Specify only one of the options. + The '--mode' and '--self-contained' options conflict. Specify only one of the options. + + + + The specified publish mode '{0}' is not supported. + The specified publish mode '{0}' is not supported. + + \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-publish/xlf/LocalizableStrings.ko.xlf b/src/dotnet/commands/dotnet-publish/xlf/LocalizableStrings.ko.xlf index f861e1c249..1e879682f6 100644 --- a/src/dotnet/commands/dotnet-publish/xlf/LocalizableStrings.ko.xlf +++ b/src/dotnet/commands/dotnet-publish/xlf/LocalizableStrings.ko.xlf @@ -37,22 +37,16 @@ 게시 단계에서 제외할 패키지 목록이 들어 있는 대상 매니페스트 파일의 경로입니다. - - 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. - 런타임은 대상 컴퓨터에 설치할 필요가 없으므로 응용 프로그램과 함께 .NET Core 런타임을 게시합니다. 런타임 식별자가 지정된 경우 기본값은 'true'입니다. - - Do not build the project before publishing. Implies --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 with an executable if a target runtime is specified. +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 with an executable if a target runtime is specified. +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 conflict. Specify only one of the options. + The '--mode' and '--self-contained' options conflict. Specify only one of the options. + + + + The specified publish mode '{0}' is not supported. + The specified publish mode '{0}' is not supported. + + \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-publish/xlf/LocalizableStrings.pl.xlf b/src/dotnet/commands/dotnet-publish/xlf/LocalizableStrings.pl.xlf index a44c784450..24d8a39b89 100644 --- a/src/dotnet/commands/dotnet-publish/xlf/LocalizableStrings.pl.xlf +++ b/src/dotnet/commands/dotnet-publish/xlf/LocalizableStrings.pl.xlf @@ -37,22 +37,16 @@ Ścieżka do docelowego pliku manifestu zawierającego listę pakietów, które mają zostać wykluczone z kroku publikowania. - - 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. - Opublikuj środowisko uruchomieniowe programu .NET Core z aplikacją, aby nie trzeba było go instalować na maszynie docelowej. Domyślnie jest ustawiona wartość „true” w przypadku określenia identyfikatora środowiska uruchomieniowego. - - Do not build the project before publishing. Implies --no-restore. Nie kompiluj tego projektu przed opublikowaniem. Powoduje przyjęcie, że podano parametr --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 with an executable if a target runtime is specified. +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 with an executable if a target runtime is specified. +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 conflict. Specify only one of the options. + The '--mode' and '--self-contained' options conflict. Specify only one of the options. + + + + The specified publish mode '{0}' is not supported. + The specified publish mode '{0}' is not supported. + + \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-publish/xlf/LocalizableStrings.pt-BR.xlf b/src/dotnet/commands/dotnet-publish/xlf/LocalizableStrings.pt-BR.xlf index 59445fae70..55df48df74 100644 --- a/src/dotnet/commands/dotnet-publish/xlf/LocalizableStrings.pt-BR.xlf +++ b/src/dotnet/commands/dotnet-publish/xlf/LocalizableStrings.pt-BR.xlf @@ -37,22 +37,16 @@ O caminho para um arquivo de manifesto de destino que contém a lista de pacotes a serem excluídos da etapa de publicação. - - 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. - Publique o tempo de execução .NET Core com seu aplicativo para que o tempo de execução não precise ser instalado no computador de destino. Assumirá 'true' como padrão se um identificador de tempo de execução for especificado. - - Do not build the project before publishing. Implies --no-restore. Não compile o projeto antes de publicar. Implica em --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 with an executable if a target runtime is specified. +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 with an executable if a target runtime is specified. +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 conflict. Specify only one of the options. + The '--mode' and '--self-contained' options conflict. Specify only one of the options. + + + + The specified publish mode '{0}' is not supported. + The specified publish mode '{0}' is not supported. + + \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-publish/xlf/LocalizableStrings.ru.xlf b/src/dotnet/commands/dotnet-publish/xlf/LocalizableStrings.ru.xlf index a79f188dee..084aad81c5 100644 --- a/src/dotnet/commands/dotnet-publish/xlf/LocalizableStrings.ru.xlf +++ b/src/dotnet/commands/dotnet-publish/xlf/LocalizableStrings.ru.xlf @@ -37,22 +37,16 @@ Путь к целевому файлу манифеста, содержащему список пакетов, исключаемых из публикации. - - 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. - Опубликуйте среду выполнения .NET Core вместе с приложением, чтобы ее не нужно было устанавливать на целевом компьютере. Если идентификатор среды выполнения указан, значение по умолчанию — true. - - Do not build the project before publishing. Implies --no-restore. Сборка проекта перед публикацией не выполняется. Подразумевает --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 with an executable if a target runtime is specified. +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 with an executable if a target runtime is specified. +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 conflict. Specify only one of the options. + The '--mode' and '--self-contained' options conflict. Specify only one of the options. + + + + The specified publish mode '{0}' is not supported. + The specified publish mode '{0}' is not supported. + + \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-publish/xlf/LocalizableStrings.tr.xlf b/src/dotnet/commands/dotnet-publish/xlf/LocalizableStrings.tr.xlf index 3e2339ef72..daa82317b6 100644 --- a/src/dotnet/commands/dotnet-publish/xlf/LocalizableStrings.tr.xlf +++ b/src/dotnet/commands/dotnet-publish/xlf/LocalizableStrings.tr.xlf @@ -37,22 +37,16 @@ Yayımlama adımının dışında tutulacak paketlerin listesini içeren bir hedef bildirim dosyasının yolu. - - 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. - Çalışma zamanının hedef makineye yüklenmesine gerek kalmaması için, .NET Core çalışma zamanını uygulamanızla birlikte yayımlayın. Bir çalışma zamanı tanımlayıcısı belirtilmişse, varsayılan olarak 'true' değerine ayarlanır. - - Do not build the project before publishing. Implies --no-restore. Yayımlamadan önce projeyi derlemeyin. --no-restore anlamına gelir. - 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 with an executable if a target runtime is specified. +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 with an executable if a target runtime is specified. +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 conflict. Specify only one of the options. + The '--mode' and '--self-contained' options conflict. Specify only one of the options. + + + + The specified publish mode '{0}' is not supported. + The specified publish mode '{0}' is not supported. + + \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-publish/xlf/LocalizableStrings.zh-Hans.xlf b/src/dotnet/commands/dotnet-publish/xlf/LocalizableStrings.zh-Hans.xlf index 1926cf1ddc..0a3631a914 100644 --- a/src/dotnet/commands/dotnet-publish/xlf/LocalizableStrings.zh-Hans.xlf +++ b/src/dotnet/commands/dotnet-publish/xlf/LocalizableStrings.zh-Hans.xlf @@ -37,22 +37,16 @@ 指向目标清单文件的路径,该文件包含要通过发布步骤执行的包的列表。 - - 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. - 随附应用程序发布 .NET Core 运行时,免除在目标计算机上安装运行时的需求。如果指定了运行时标识符,则默认为 “true”。 - - Do not build the project before publishing. Implies --no-restore. 发布之前不要生成项目。Implies --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 with an executable if a target runtime is specified. +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 with an executable if a target runtime is specified. +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 conflict. Specify only one of the options. + The '--mode' and '--self-contained' options conflict. Specify only one of the options. + + + + The specified publish mode '{0}' is not supported. + The specified publish mode '{0}' is not supported. + + \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-publish/xlf/LocalizableStrings.zh-Hant.xlf b/src/dotnet/commands/dotnet-publish/xlf/LocalizableStrings.zh-Hant.xlf index b4379233d9..f0e5d9bcb9 100644 --- a/src/dotnet/commands/dotnet-publish/xlf/LocalizableStrings.zh-Hant.xlf +++ b/src/dotnet/commands/dotnet-publish/xlf/LocalizableStrings.zh-Hant.xlf @@ -37,22 +37,16 @@ 目標資訊清單檔案的路徑,其包含要從發行步驟中排除的套件清單。 - - 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. - 隨著應用程式一併發行 .NET Core 執行階段,因此不需要在目標電腦上安裝此執行階段。若指定了執行階段識別碼,則預設為 'true'。 - - Do not build the project before publishing. Implies --no-restore. 請勿在執行之前建置專案。提示:-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 with an executable if a target runtime is specified. +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 with an executable if a target runtime is specified. +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 conflict. Specify only one of the options. + The '--mode' and '--self-contained' options conflict. Specify only one of the options. + + + + The specified publish mode '{0}' is not supported. + The specified publish mode '{0}' is not supported. + + \ No newline at end of file diff --git a/test/Microsoft.DotNet.Tools.Tests.Utilities/Commands/PublishCommand.cs b/test/Microsoft.DotNet.Tools.Tests.Utilities/Commands/PublishCommand.cs index ada6a80be0..a22b5acf76 100644 --- a/test/Microsoft.DotNet.Tools.Tests.Utilities/Commands/PublishCommand.cs +++ b/test/Microsoft.DotNet.Tools.Tests.Utilities/Commands/PublishCommand.cs @@ -13,7 +13,7 @@ public sealed class PublishCommand : DotnetCommand private string _output; private string _runtime; private List _targetManifests = new List(); - private bool? _selfContained; + private string _mode; public PublishCommand WithFramework(string framework) { @@ -44,9 +44,9 @@ public PublishCommand WithTargetManifest(string manifest) return this; } - public PublishCommand WithSelfContained(bool value) + public PublishCommand WithMode(string value) { - _selfContained = value; + _mode = value; return this; } @@ -69,7 +69,7 @@ private string BuildArgs() OutputOption, TargetOption, RuntimeOption, - SelfContainedOption); + ModeOption); } private string FrameworkOption => string.IsNullOrEmpty(_framework) ? "" : $"-f {_framework}"; @@ -80,6 +80,6 @@ private string BuildArgs() private string TargetOption => string.Join(" ", _targetManifests); - private string SelfContainedOption => _selfContained.HasValue ? $"--self-contained:{_selfContained.Value}" : ""; + private string ModeOption => string.IsNullOrEmpty(_mode) ? "" : $"--mode {_mode}"; } } diff --git a/test/dotnet-publish.Tests/GivenDotnetPublishPublishesProjects.cs b/test/dotnet-publish.Tests/GivenDotnetPublishPublishesProjects.cs index 9b325256f9..9aa9ad4dc1 100644 --- a/test/dotnet-publish.Tests/GivenDotnetPublishPublishesProjects.cs +++ b/test/dotnet-publish.Tests/GivenDotnetPublishPublishesProjects.cs @@ -11,6 +11,7 @@ using Microsoft.DotNet.TestFramework; using Microsoft.DotNet.Tools.Test.Utilities; using Xunit; +using LocalizableStrings = Microsoft.DotNet.Tools.Publish.LocalizableStrings; namespace Microsoft.DotNet.Cli.Publish.Tests { @@ -95,34 +96,43 @@ public void ItDoesNotImplicitlyRestoreAProjectWhenPublishingWithTheNoRestoreOpti .And.HaveStdOutContaining("project.assets.json"); } - [Fact] - public void ItPublishesARunnableSelfContainedApp() + [Theory] + [InlineData("self-contained", null)] + [InlineData(null, null)] + [InlineData(null, "--self-contained")] + [InlineData(null, "--self-contained=true")] + public void ItPublishesSelfContainedWithRid(string mode, string args) { var testAppName = "MSBuildTestApp"; + var rid = DotnetLegacyRuntimeIdentifiers.InferLegacyRestoreRuntimeIdentifier(); + var outputDirectory = PublishApp(testAppName, rid, mode, args); - var testInstance = TestAssets.Get(testAppName) - .CreateInstance() - .WithSourceFiles() - .WithRestoreFiles(); + var outputProgram = Path.Combine(outputDirectory.FullName, $"{testAppName}{Constants.ExeSuffix}"); - var testProjectDirectory = testInstance.Root; + new TestCommand(outputProgram) + .ExecuteWithCapturedOutput() + .Should().Pass() + .And.HaveStdOutContaining("Hello World"); + } + [Theory] + [InlineData("fx-dependent", null)] + [InlineData(null, "--self-contained=false")] + public void ItPublishesFrameworkDependentWithRid(string mode, string args) + { + var testAppName = "MSBuildTestApp"; var rid = DotnetLegacyRuntimeIdentifiers.InferLegacyRestoreRuntimeIdentifier(); + var outputDirectory = PublishApp(testAppName, rid, mode, args); - new PublishCommand() - .WithFramework("netcoreapp2.1") - .WithRuntime(rid) - .WithWorkingDirectory(testProjectDirectory) - .Execute() - .Should().Pass(); - - var configuration = Environment.GetEnvironmentVariable("CONFIGURATION") ?? "Debug"; - - var outputProgram = testProjectDirectory - .GetDirectory("bin", configuration, "netcoreapp2.1", rid, "publish", $"{testAppName}{Constants.ExeSuffix}") - .FullName; + outputDirectory.Should().OnlyHaveFiles(new[] { + $"{testAppName}{Constants.ExeSuffix}", + $"{testAppName}.dll", + $"{testAppName}.pdb", + $"{testAppName}.deps.json", + $"{testAppName}.runtimeconfig.json", + }); - EnsureProgramIsRunnable(outputProgram); + var outputProgram = Path.Combine(outputDirectory.FullName, $"{testAppName}{Constants.ExeSuffix}"); new TestCommand(outputProgram) .ExecuteWithCapturedOutput() @@ -131,26 +141,34 @@ public void ItPublishesARunnableSelfContainedApp() } [Fact] - public void ItPublishesARidSpecificAppSettingSelfContainedToTrue() + public void ItPublishesFrameworkDependentNoExeWithRid() { var testAppName = "MSBuildTestApp"; - var outputDirectory = PublishAppWithSelfContained(testAppName, true); - - var outputProgram = Path.Combine(outputDirectory.FullName, $"{testAppName}{Constants.ExeSuffix}"); + var rid = DotnetLegacyRuntimeIdentifiers.InferLegacyRestoreRuntimeIdentifier(); + var outputDirectory = PublishApp(testAppName, rid, mode: "fx-dependent-no-exe"); - EnsureProgramIsRunnable(outputProgram); + outputDirectory.Should().OnlyHaveFiles(new[] { + $"{testAppName}.dll", + $"{testAppName}.pdb", + $"{testAppName}.deps.json", + $"{testAppName}.runtimeconfig.json", + }); - new TestCommand(outputProgram) - .ExecuteWithCapturedOutput() + new DotnetCommand() + .ExecuteWithCapturedOutput(Path.Combine(outputDirectory.FullName, $"{testAppName}.dll")) .Should().Pass() .And.HaveStdOutContaining("Hello World"); } - [Fact] - public void ItPublishesARidSpecificAppSettingSelfContainedToFalse() + [Theory] + [InlineData("fx-dependent-no-exe", null)] + [InlineData("fx-dependent", null)] + [InlineData(null, "--self-contained=false")] + [InlineData(null, null)] + public void ItPublishesFrameworkDependentWithoutRid(string mode, string args) { var testAppName = "MSBuildTestApp"; - var outputDirectory = PublishAppWithSelfContained(testAppName, false); + var outputDirectory = PublishApp(testAppName, rid: null, mode: mode, args: args); outputDirectory.Should().OnlyHaveFiles(new[] { $"{testAppName}.dll", @@ -165,36 +183,25 @@ public void ItPublishesARidSpecificAppSettingSelfContainedToFalse() .And.HaveStdOutContaining("Hello World"); } - private DirectoryInfo PublishAppWithSelfContained(string testAppName, bool selfContained) + private DirectoryInfo PublishApp(string testAppName, string rid, string mode, string args = null) { var testInstance = TestAssets.Get(testAppName) - .CreateInstance($"PublishesSelfContained{selfContained}") + .CreateInstance($"PublishApp_{rid ?? "none"}_{mode ?? "none"}") .WithSourceFiles() .WithRestoreFiles(); var testProjectDirectory = testInstance.Root; - var rid = DotnetLegacyRuntimeIdentifiers.InferLegacyRestoreRuntimeIdentifier(); - new PublishCommand() .WithRuntime(rid) - .WithSelfContained(selfContained) + .WithMode(mode) .WithWorkingDirectory(testProjectDirectory) - .Execute() + .Execute(args ?? "") .Should().Pass(); var configuration = Environment.GetEnvironmentVariable("CONFIGURATION") ?? "Debug"; return testProjectDirectory - .GetDirectory("bin", configuration, "netcoreapp2.1", rid, "publish"); - } - - private static void EnsureProgramIsRunnable(string path) - { - if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) - { - //Workaround for https://github.com/dotnet/corefx/issues/15516 - Process.Start("chmod", $"u+x {path}").WaitForExit(); - } + .GetDirectory("bin", configuration, "netcoreapp2.1", rid ?? "", "publish"); } [Fact] @@ -324,5 +331,24 @@ public void ItFailsToPublishWithNoBuildIfPreviouslyBuiltWithoutRid() .Should() .Fail(); } + + [Fact] + public void ItFailsToPublishIfBothModeAndSelfContainedAreSpecified() + { + var testInstance = TestAssets.Get("MSBuildTestApp") + .CreateInstance() + .WithSourceFiles() + .WithRestoreFiles(); + + var testProjectDirectory = testInstance.Root; + + new PublishCommand() + .WithWorkingDirectory(testProjectDirectory) + .Execute("--self-contained --mode fx-dependent") + .Should() + .Fail() + .And + .HaveStdErrContaining(LocalizableStrings.PublishModeAndSelfContainedOptionsConflict); + } } } diff --git a/test/dotnet-publish.Tests/dotnet-publish.Tests.csproj b/test/dotnet-publish.Tests/dotnet-publish.Tests.csproj index 77012ff8d4..51c2ff9243 100644 --- a/test/dotnet-publish.Tests/dotnet-publish.Tests.csproj +++ b/test/dotnet-publish.Tests/dotnet-publish.Tests.csproj @@ -4,6 +4,9 @@ $(MicrosoftNETCoreAppPackageVersion) true dotnet-publish.Tests + ../../tools/Key.snk + true + true $(AssetTargetFallback);dotnet5.4;portable-net451+win8 @@ -16,6 +19,7 @@ + From da2b1b90ec2d449dca552640f149f4e0b9e099ba Mon Sep 17 00:00:00 2001 From: Peter Huene Date: Mon, 11 Jun 2018 21:31:48 -0700 Subject: [PATCH 2/3] Fix PR review feedback. Amending string resources based on suggestions. Fixing tests that need DOTNET_ROOT set. Adding args to the asset instance name for `PublishApp`. --- .../dotnet-publish/LocalizableStrings.resx | 4 ++-- .../dotnet-publish/xlf/LocalizableStrings.cs.xlf | 8 ++++---- .../dotnet-publish/xlf/LocalizableStrings.de.xlf | 8 ++++---- .../dotnet-publish/xlf/LocalizableStrings.es.xlf | 8 ++++---- .../dotnet-publish/xlf/LocalizableStrings.fr.xlf | 8 ++++---- .../dotnet-publish/xlf/LocalizableStrings.it.xlf | 8 ++++---- .../dotnet-publish/xlf/LocalizableStrings.ja.xlf | 8 ++++---- .../dotnet-publish/xlf/LocalizableStrings.ko.xlf | 8 ++++---- .../dotnet-publish/xlf/LocalizableStrings.pl.xlf | 8 ++++---- .../xlf/LocalizableStrings.pt-BR.xlf | 8 ++++---- .../dotnet-publish/xlf/LocalizableStrings.ru.xlf | 8 ++++---- .../dotnet-publish/xlf/LocalizableStrings.tr.xlf | 8 ++++---- .../xlf/LocalizableStrings.zh-Hans.xlf | 8 ++++---- .../xlf/LocalizableStrings.zh-Hant.xlf | 8 ++++---- .../GivenDotnetPublishPublishesProjects.cs | 14 +++++++++----- 15 files changed, 63 insertions(+), 59 deletions(-) diff --git a/src/dotnet/commands/dotnet-publish/LocalizableStrings.resx b/src/dotnet/commands/dotnet-publish/LocalizableStrings.resx index 6a11341d8f..59c01c3af3 100644 --- a/src/dotnet/commands/dotnet-publish/LocalizableStrings.resx +++ b/src/dotnet/commands/dotnet-publish/LocalizableStrings.resx @@ -138,7 +138,7 @@ 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 with an executable if a target runtime is specified. +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. @@ -160,7 +160,7 @@ The default is to publish a framework-dependent application without an executabl The configuration to publish for. The default for most projects is 'Debug'. - The '--mode' and '--self-contained' options conflict. 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. diff --git a/src/dotnet/commands/dotnet-publish/xlf/LocalizableStrings.cs.xlf b/src/dotnet/commands/dotnet-publish/xlf/LocalizableStrings.cs.xlf index d8802bc579..65cdf77c08 100644 --- a/src/dotnet/commands/dotnet-publish/xlf/LocalizableStrings.cs.xlf +++ b/src/dotnet/commands/dotnet-publish/xlf/LocalizableStrings.cs.xlf @@ -57,13 +57,13 @@ The default is to publish a framework-dependent application without an executabl 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 with an executable if a target runtime is specified. +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 with an executable if a target runtime is specified. +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. @@ -75,8 +75,8 @@ The default is 'self-contained' when a target runtime is specified. - The '--mode' and '--self-contained' options conflict. Specify only one of the options. - The '--mode' and '--self-contained' options conflict. Specify only one of the options. + 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. diff --git a/src/dotnet/commands/dotnet-publish/xlf/LocalizableStrings.de.xlf b/src/dotnet/commands/dotnet-publish/xlf/LocalizableStrings.de.xlf index e26d57f71d..54fe79e46d 100644 --- a/src/dotnet/commands/dotnet-publish/xlf/LocalizableStrings.de.xlf +++ b/src/dotnet/commands/dotnet-publish/xlf/LocalizableStrings.de.xlf @@ -57,13 +57,13 @@ The default is to publish a framework-dependent application without an executabl 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 with an executable if a target runtime is specified. +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 with an executable if a target runtime is specified. +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. @@ -75,8 +75,8 @@ The default is 'self-contained' when a target runtime is specified. - The '--mode' and '--self-contained' options conflict. Specify only one of the options. - The '--mode' and '--self-contained' options conflict. Specify only one of the options. + 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. diff --git a/src/dotnet/commands/dotnet-publish/xlf/LocalizableStrings.es.xlf b/src/dotnet/commands/dotnet-publish/xlf/LocalizableStrings.es.xlf index baa3744c32..d71ab145b8 100644 --- a/src/dotnet/commands/dotnet-publish/xlf/LocalizableStrings.es.xlf +++ b/src/dotnet/commands/dotnet-publish/xlf/LocalizableStrings.es.xlf @@ -57,13 +57,13 @@ The default is to publish a framework-dependent application without an executabl 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 with an executable if a target runtime is specified. +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 with an executable if a target runtime is specified. +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. @@ -75,8 +75,8 @@ The default is 'self-contained' when a target runtime is specified. - The '--mode' and '--self-contained' options conflict. Specify only one of the options. - The '--mode' and '--self-contained' options conflict. Specify only one of the options. + 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. diff --git a/src/dotnet/commands/dotnet-publish/xlf/LocalizableStrings.fr.xlf b/src/dotnet/commands/dotnet-publish/xlf/LocalizableStrings.fr.xlf index 73ab78be8c..dbc2c0835d 100644 --- a/src/dotnet/commands/dotnet-publish/xlf/LocalizableStrings.fr.xlf +++ b/src/dotnet/commands/dotnet-publish/xlf/LocalizableStrings.fr.xlf @@ -57,13 +57,13 @@ The default is to publish a framework-dependent application without an executabl 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 with an executable if a target runtime is specified. +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 with an executable if a target runtime is specified. +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. @@ -75,8 +75,8 @@ The default is 'self-contained' when a target runtime is specified. - The '--mode' and '--self-contained' options conflict. Specify only one of the options. - The '--mode' and '--self-contained' options conflict. Specify only one of the options. + 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. diff --git a/src/dotnet/commands/dotnet-publish/xlf/LocalizableStrings.it.xlf b/src/dotnet/commands/dotnet-publish/xlf/LocalizableStrings.it.xlf index fd9e38f7ac..d6b3ca3ca7 100644 --- a/src/dotnet/commands/dotnet-publish/xlf/LocalizableStrings.it.xlf +++ b/src/dotnet/commands/dotnet-publish/xlf/LocalizableStrings.it.xlf @@ -57,13 +57,13 @@ The default is to publish a framework-dependent application without an executabl 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 with an executable if a target runtime is specified. +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 with an executable if a target runtime is specified. +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. @@ -75,8 +75,8 @@ The default is 'self-contained' when a target runtime is specified. - The '--mode' and '--self-contained' options conflict. Specify only one of the options. - The '--mode' and '--self-contained' options conflict. Specify only one of the options. + 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. diff --git a/src/dotnet/commands/dotnet-publish/xlf/LocalizableStrings.ja.xlf b/src/dotnet/commands/dotnet-publish/xlf/LocalizableStrings.ja.xlf index 89904c4769..36949f48d8 100644 --- a/src/dotnet/commands/dotnet-publish/xlf/LocalizableStrings.ja.xlf +++ b/src/dotnet/commands/dotnet-publish/xlf/LocalizableStrings.ja.xlf @@ -57,13 +57,13 @@ The default is to publish a framework-dependent application without an executabl 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 with an executable if a target runtime is specified. +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 with an executable if a target runtime is specified. +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. @@ -75,8 +75,8 @@ The default is 'self-contained' when a target runtime is specified. - The '--mode' and '--self-contained' options conflict. Specify only one of the options. - The '--mode' and '--self-contained' options conflict. Specify only one of the options. + 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. diff --git a/src/dotnet/commands/dotnet-publish/xlf/LocalizableStrings.ko.xlf b/src/dotnet/commands/dotnet-publish/xlf/LocalizableStrings.ko.xlf index 1e879682f6..b5781e2e61 100644 --- a/src/dotnet/commands/dotnet-publish/xlf/LocalizableStrings.ko.xlf +++ b/src/dotnet/commands/dotnet-publish/xlf/LocalizableStrings.ko.xlf @@ -57,13 +57,13 @@ The default is to publish a framework-dependent application without an executabl 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 with an executable if a target runtime is specified. +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 with an executable if a target runtime is specified. +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. @@ -75,8 +75,8 @@ The default is 'self-contained' when a target runtime is specified. - The '--mode' and '--self-contained' options conflict. Specify only one of the options. - The '--mode' and '--self-contained' options conflict. Specify only one of the options. + 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. diff --git a/src/dotnet/commands/dotnet-publish/xlf/LocalizableStrings.pl.xlf b/src/dotnet/commands/dotnet-publish/xlf/LocalizableStrings.pl.xlf index 24d8a39b89..cb4c0c9818 100644 --- a/src/dotnet/commands/dotnet-publish/xlf/LocalizableStrings.pl.xlf +++ b/src/dotnet/commands/dotnet-publish/xlf/LocalizableStrings.pl.xlf @@ -57,13 +57,13 @@ The default is to publish a framework-dependent application without an executabl 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 with an executable if a target runtime is specified. +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 with an executable if a target runtime is specified. +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. @@ -75,8 +75,8 @@ The default is 'self-contained' when a target runtime is specified. - The '--mode' and '--self-contained' options conflict. Specify only one of the options. - The '--mode' and '--self-contained' options conflict. Specify only one of the options. + 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. diff --git a/src/dotnet/commands/dotnet-publish/xlf/LocalizableStrings.pt-BR.xlf b/src/dotnet/commands/dotnet-publish/xlf/LocalizableStrings.pt-BR.xlf index 55df48df74..f7c91c76c2 100644 --- a/src/dotnet/commands/dotnet-publish/xlf/LocalizableStrings.pt-BR.xlf +++ b/src/dotnet/commands/dotnet-publish/xlf/LocalizableStrings.pt-BR.xlf @@ -57,13 +57,13 @@ The default is to publish a framework-dependent application without an executabl 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 with an executable if a target runtime is specified. +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 with an executable if a target runtime is specified. +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. @@ -75,8 +75,8 @@ The default is 'self-contained' when a target runtime is specified. - The '--mode' and '--self-contained' options conflict. Specify only one of the options. - The '--mode' and '--self-contained' options conflict. Specify only one of the options. + 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. diff --git a/src/dotnet/commands/dotnet-publish/xlf/LocalizableStrings.ru.xlf b/src/dotnet/commands/dotnet-publish/xlf/LocalizableStrings.ru.xlf index 084aad81c5..2b269e4ec6 100644 --- a/src/dotnet/commands/dotnet-publish/xlf/LocalizableStrings.ru.xlf +++ b/src/dotnet/commands/dotnet-publish/xlf/LocalizableStrings.ru.xlf @@ -57,13 +57,13 @@ The default is to publish a framework-dependent application without an executabl 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 with an executable if a target runtime is specified. +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 with an executable if a target runtime is specified. +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. @@ -75,8 +75,8 @@ The default is 'self-contained' when a target runtime is specified. - The '--mode' and '--self-contained' options conflict. Specify only one of the options. - The '--mode' and '--self-contained' options conflict. Specify only one of the options. + 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. diff --git a/src/dotnet/commands/dotnet-publish/xlf/LocalizableStrings.tr.xlf b/src/dotnet/commands/dotnet-publish/xlf/LocalizableStrings.tr.xlf index daa82317b6..d39339db9e 100644 --- a/src/dotnet/commands/dotnet-publish/xlf/LocalizableStrings.tr.xlf +++ b/src/dotnet/commands/dotnet-publish/xlf/LocalizableStrings.tr.xlf @@ -57,13 +57,13 @@ The default is to publish a framework-dependent application without an executabl 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 with an executable if a target runtime is specified. +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 with an executable if a target runtime is specified. +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. @@ -75,8 +75,8 @@ The default is 'self-contained' when a target runtime is specified. - The '--mode' and '--self-contained' options conflict. Specify only one of the options. - The '--mode' and '--self-contained' options conflict. Specify only one of the options. + 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. diff --git a/src/dotnet/commands/dotnet-publish/xlf/LocalizableStrings.zh-Hans.xlf b/src/dotnet/commands/dotnet-publish/xlf/LocalizableStrings.zh-Hans.xlf index 0a3631a914..277fcd58e4 100644 --- a/src/dotnet/commands/dotnet-publish/xlf/LocalizableStrings.zh-Hans.xlf +++ b/src/dotnet/commands/dotnet-publish/xlf/LocalizableStrings.zh-Hans.xlf @@ -57,13 +57,13 @@ The default is to publish a framework-dependent application without an executabl 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 with an executable if a target runtime is specified. +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 with an executable if a target runtime is specified. +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. @@ -75,8 +75,8 @@ The default is 'self-contained' when a target runtime is specified. - The '--mode' and '--self-contained' options conflict. Specify only one of the options. - The '--mode' and '--self-contained' options conflict. Specify only one of the options. + 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. diff --git a/src/dotnet/commands/dotnet-publish/xlf/LocalizableStrings.zh-Hant.xlf b/src/dotnet/commands/dotnet-publish/xlf/LocalizableStrings.zh-Hant.xlf index f0e5d9bcb9..a23a56120d 100644 --- a/src/dotnet/commands/dotnet-publish/xlf/LocalizableStrings.zh-Hant.xlf +++ b/src/dotnet/commands/dotnet-publish/xlf/LocalizableStrings.zh-Hant.xlf @@ -57,13 +57,13 @@ The default is to publish a framework-dependent application without an executabl 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 with an executable if a target runtime is specified. +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 with an executable if a target runtime is specified. +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. @@ -75,8 +75,8 @@ The default is 'self-contained' when a target runtime is specified. - The '--mode' and '--self-contained' options conflict. Specify only one of the options. - The '--mode' and '--self-contained' options conflict. Specify only one of the options. + 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. diff --git a/test/dotnet-publish.Tests/GivenDotnetPublishPublishesProjects.cs b/test/dotnet-publish.Tests/GivenDotnetPublishPublishesProjects.cs index 9aa9ad4dc1..b9da56f115 100644 --- a/test/dotnet-publish.Tests/GivenDotnetPublishPublishesProjects.cs +++ b/test/dotnet-publish.Tests/GivenDotnetPublishPublishesProjects.cs @@ -134,10 +134,14 @@ public void ItPublishesFrameworkDependentWithRid(string mode, string args) var outputProgram = Path.Combine(outputDirectory.FullName, $"{testAppName}{Constants.ExeSuffix}"); - new TestCommand(outputProgram) - .ExecuteWithCapturedOutput() - .Should().Pass() - .And.HaveStdOutContaining("Hello World"); + var command = new TestCommand(outputProgram); + command.Environment["DOTNET_ROOT"]= new RepoDirectoriesProvider().DotnetRoot; + + command.ExecuteWithCapturedOutput() + .Should() + .Pass() + .And + .HaveStdOutContaining("Hello World"); } [Fact] @@ -186,7 +190,7 @@ public void ItPublishesFrameworkDependentWithoutRid(string mode, string args) private DirectoryInfo PublishApp(string testAppName, string rid, string mode, string args = null) { var testInstance = TestAssets.Get(testAppName) - .CreateInstance($"PublishApp_{rid ?? "none"}_{mode ?? "none"}") + .CreateInstance($"PublishApp_{rid ?? "none"}_{mode ?? "none"}_{args ?? "none"}") .WithSourceFiles() .WithRestoreFiles(); From 8205dd4a150e5f714f45b92dc18f7510185751af Mon Sep 17 00:00:00 2001 From: Peter Huene Date: Mon, 11 Jun 2018 21:55:47 -0700 Subject: [PATCH 3/3] Fix publish test for 32-bit environments. Ensure the correct DOTNET_ROOT variable is set for the apphost being run. --- .../GivenDotnetPublishPublishesProjects.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/dotnet-publish.Tests/GivenDotnetPublishPublishesProjects.cs b/test/dotnet-publish.Tests/GivenDotnetPublishPublishesProjects.cs index b9da56f115..01e4b59220 100644 --- a/test/dotnet-publish.Tests/GivenDotnetPublishPublishesProjects.cs +++ b/test/dotnet-publish.Tests/GivenDotnetPublishPublishesProjects.cs @@ -135,7 +135,8 @@ public void ItPublishesFrameworkDependentWithRid(string mode, string args) var outputProgram = Path.Combine(outputDirectory.FullName, $"{testAppName}{Constants.ExeSuffix}"); var command = new TestCommand(outputProgram); - command.Environment["DOTNET_ROOT"]= new RepoDirectoriesProvider().DotnetRoot; + command.Environment[Environment.Is64BitProcess ? "DOTNET_ROOT" : "DOTNET_ROOT(x86)"] = + new RepoDirectoriesProvider().DotnetRoot; command.ExecuteWithCapturedOutput() .Should()