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 | 138 +++++++++++------- .../dotnet-publish.Tests.csproj | 4 + 21 files changed, 597 insertions(+), 198 deletions(-) diff --git a/build/DependencyVersions.props b/build/DependencyVersions.props index 7587a5865..a2b8bb466 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 b5f0b8fe0..8b1c62cd5 100644 --- a/src/dotnet/Properties/AssemblyInfo.cs +++ b/src/dotnet/Properties/AssemblyInfo.cs @@ -9,6 +9,7 @@ using System.Runtime.CompilerServices; [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 ebdf1fe0a..6a11341d8 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 ed8f3260c..631416b82 100644 --- a/src/dotnet/commands/dotnet-publish/Program.cs +++ b/src/dotnet/commands/dotnet-publish/Program.cs @@ -39,6 +39,37 @@ namespace Microsoft.DotNet.Tools.Publish 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 19ee3ec12..96519680f 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 @@ namespace Microsoft.DotNet.Cli 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 @@ namespace Microsoft.DotNet.Cli 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 fb4bc6d55..d8802bc57 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 60b8b2a50..e26d57f71 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 3e18e4ab9..baa3744c3 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 b80796a49..73ab78be8 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 70e1cde81..fd9e38f7a 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 66e3fb513..89904c476 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 f861e1c24..1e879682f 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 a44c78445..24d8a39b8 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 59445fae7..55df48df7 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 a79f188de..084aad81c 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 3e2339ef7..daa82317b 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 1926cf1dd..0a3631a91 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 b4379233d..f0e5d9bcb 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 ada6a80be..a22b5acf7 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 @@ namespace Microsoft.DotNet.Tools.Test.Utilities 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 @@ namespace Microsoft.DotNet.Tools.Test.Utilities return this; } - public PublishCommand WithSelfContained(bool value) + public PublishCommand WithMode(string value) { - _selfContained = value; + _mode = value; return this; } @@ -69,7 +69,7 @@ namespace Microsoft.DotNet.Tools.Test.Utilities OutputOption, TargetOption, RuntimeOption, - SelfContainedOption); + ModeOption); } private string FrameworkOption => string.IsNullOrEmpty(_framework) ? "" : $"-f {_framework}"; @@ -80,6 +80,6 @@ namespace Microsoft.DotNet.Tools.Test.Utilities 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 9b325256f..9aa9ad4dc 100644 --- a/test/dotnet-publish.Tests/GivenDotnetPublishPublishesProjects.cs +++ b/test/dotnet-publish.Tests/GivenDotnetPublishPublishesProjects.cs @@ -11,6 +11,7 @@ using Microsoft.DotNet.PlatformAbstractions; 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,50 +96,43 @@ namespace Microsoft.DotNet.Cli.Publish.Tests .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 testInstance = TestAssets.Get(testAppName) - .CreateInstance() - .WithSourceFiles() - .WithRestoreFiles(); - - var testProjectDirectory = testInstance.Root; - var rid = DotnetLegacyRuntimeIdentifiers.InferLegacyRestoreRuntimeIdentifier(); - - 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; - - EnsureProgramIsRunnable(outputProgram); - - new TestCommand(outputProgram) - .ExecuteWithCapturedOutput() - .Should().Pass() - .And.HaveStdOutContaining("Hello World"); - } - - [Fact] - public void ItPublishesARidSpecificAppSettingSelfContainedToTrue() - { - var testAppName = "MSBuildTestApp"; - var outputDirectory = PublishAppWithSelfContained(testAppName, true); + var outputDirectory = PublishApp(testAppName, rid, mode, args); var outputProgram = Path.Combine(outputDirectory.FullName, $"{testAppName}{Constants.ExeSuffix}"); - EnsureProgramIsRunnable(outputProgram); + 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); + + outputDirectory.Should().OnlyHaveFiles(new[] { + $"{testAppName}{Constants.ExeSuffix}", + $"{testAppName}.dll", + $"{testAppName}.pdb", + $"{testAppName}.deps.json", + $"{testAppName}.runtimeconfig.json", + }); + + var outputProgram = Path.Combine(outputDirectory.FullName, $"{testAppName}{Constants.ExeSuffix}"); new TestCommand(outputProgram) .ExecuteWithCapturedOutput() @@ -147,10 +141,11 @@ namespace Microsoft.DotNet.Cli.Publish.Tests } [Fact] - public void ItPublishesARidSpecificAppSettingSelfContainedToFalse() + public void ItPublishesFrameworkDependentNoExeWithRid() { var testAppName = "MSBuildTestApp"; - var outputDirectory = PublishAppWithSelfContained(testAppName, false); + var rid = DotnetLegacyRuntimeIdentifiers.InferLegacyRestoreRuntimeIdentifier(); + var outputDirectory = PublishApp(testAppName, rid, mode: "fx-dependent-no-exe"); outputDirectory.Should().OnlyHaveFiles(new[] { $"{testAppName}.dll", @@ -165,36 +160,48 @@ namespace Microsoft.DotNet.Cli.Publish.Tests .And.HaveStdOutContaining("Hello World"); } - private DirectoryInfo PublishAppWithSelfContained(string testAppName, bool selfContained) + [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 = PublishApp(testAppName, rid: null, mode: mode, args: args); + + outputDirectory.Should().OnlyHaveFiles(new[] { + $"{testAppName}.dll", + $"{testAppName}.pdb", + $"{testAppName}.deps.json", + $"{testAppName}.runtimeconfig.json", + }); + + new DotnetCommand() + .ExecuteWithCapturedOutput(Path.Combine(outputDirectory.FullName, $"{testAppName}.dll")) + .Should().Pass() + .And.HaveStdOutContaining("Hello World"); + } + + 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 @@ namespace Microsoft.DotNet.Cli.Publish.Tests .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 77012ff8d..51c2ff924 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 6a11341d8..59c01c3af 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 d8802bc57..65cdf77c0 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 e26d57f71..54fe79e46 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 baa3744c3..d71ab145b 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 73ab78be8..dbc2c0835 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 fd9e38f7a..d6b3ca3ca 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 89904c476..36949f48d 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 1e879682f..b5781e2e6 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 24d8a39b8..cb4c0c981 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 55df48df7..f7c91c76c 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 084aad81c..2b269e4ec 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 daa82317b..d39339db9 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 0a3631a91..277fcd58e 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 f0e5d9bcb..a23a56120 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 9aa9ad4dc..b9da56f11 100644 --- a/test/dotnet-publish.Tests/GivenDotnetPublishPublishesProjects.cs +++ b/test/dotnet-publish.Tests/GivenDotnetPublishPublishesProjects.cs @@ -134,10 +134,14 @@ namespace Microsoft.DotNet.Cli.Publish.Tests 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 @@ namespace Microsoft.DotNet.Cli.Publish.Tests 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 b9da56f11..01e4b5922 100644 --- a/test/dotnet-publish.Tests/GivenDotnetPublishPublishesProjects.cs +++ b/test/dotnet-publish.Tests/GivenDotnetPublishPublishesProjects.cs @@ -135,7 +135,8 @@ namespace Microsoft.DotNet.Cli.Publish.Tests 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()