diff --git a/src/Cli/dotnet/CommonOptions.cs b/src/Cli/dotnet/CommonOptions.cs index 3be20c211c1f..9f148234b460 100644 --- a/src/Cli/dotnet/CommonOptions.cs +++ b/src/Cli/dotnet/CommonOptions.cs @@ -1,3 +1,6 @@ +// Copyright (c) .NET Foundation and contributors. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + using System; using System.IO; using System.Linq; @@ -30,7 +33,7 @@ public static Option VerbosityOption(Func format) => "diag", "diagnostic") .With(name: CommonLocalizableStrings.LevelArgumentName) .ForwardAsSingle(format)); - + public static Option FrameworkOption(string description) => Create.Option( "-f|--framework", @@ -39,7 +42,7 @@ public static Option FrameworkOption(string description) => .WithSuggestionsFrom(_ => Suggest.TargetFrameworksFromProjectFile()) .With(name: CommonLocalizableStrings.FrameworkArgumentName) .ForwardAsSingle(o => $"-property:TargetFramework={o.Arguments.Single()}")); - + public static Option RuntimeOption(string description, bool withShortOption = true) => Create.Option( withShortOption ? "-r|--runtime" : "--runtime", @@ -48,7 +51,14 @@ public static Option RuntimeOption(string description, bool withShortOption = tr .WithSuggestionsFrom(_ => Suggest.RunTimesFromProjectFile()) .With(name: CommonLocalizableStrings.RuntimeIdentifierArgumentName) .ForwardAsSingle(o => $"-property:RuntimeIdentifier={o.Arguments.Single()}")); - + + public static Option CurrentRuntimeOption(string description, bool withShortOption = true) => + Create.Option( + "--use-current-runtime", + description, + Accept.NoArguments() + .ForwardAs("-property:UseCurrentRuntimeIdentifier=True")); + public static Option ConfigurationOption(string description) => Create.Option( "-c|--configuration", diff --git a/src/Cli/dotnet/commands/dotnet-restore/LocalizableStrings.resx b/src/Cli/dotnet/commands/dotnet-restore/LocalizableStrings.resx index c798b6ab7efd..fb7bb2df4926 100644 --- a/src/Cli/dotnet/commands/dotnet-restore/LocalizableStrings.resx +++ b/src/Cli/dotnet/commands/dotnet-restore/LocalizableStrings.resx @@ -1,17 +1,17 @@  - @@ -141,6 +141,9 @@ The target runtime to restore packages for. + + Use current runtime as the target runtime. + PACKAGES_DIR diff --git a/src/Cli/dotnet/commands/dotnet-restore/RestoreCommandParser.cs b/src/Cli/dotnet/commands/dotnet-restore/RestoreCommandParser.cs index 1c0b36b4b30b..dba4306963d5 100644 --- a/src/Cli/dotnet/commands/dotnet-restore/RestoreCommandParser.cs +++ b/src/Cli/dotnet/commands/dotnet-restore/RestoreCommandParser.cs @@ -83,6 +83,7 @@ private static Option[] ImplicitRestoreOptions(bool showHelp = false, bool useSh .WithSuggestionsFrom(_ => Suggest.RunTimesFromProjectFile()) .With(name: LocalizableStrings.CmdRuntimeOption) .ForwardAsSingle(o => $"-property:RuntimeIdentifiers={string.Join("%3B", o.Arguments)}")), + CommonOptions.CurrentRuntimeOption(LocalizableStrings.CmdCurrentRuntimeOptionDescription), Create.Option( "--packages", showHelp ? LocalizableStrings.CmdPackagesOptionDescription : string.Empty, diff --git a/src/Cli/dotnet/commands/dotnet-restore/xlf/LocalizableStrings.cs.xlf b/src/Cli/dotnet/commands/dotnet-restore/xlf/LocalizableStrings.cs.xlf index 072ffcee1ab2..1081a3085552 100644 --- a/src/Cli/dotnet/commands/dotnet-restore/xlf/LocalizableStrings.cs.xlf +++ b/src/Cli/dotnet/commands/dotnet-restore/xlf/LocalizableStrings.cs.xlf @@ -22,6 +22,11 @@ Volitelná cesta k souboru projektu nebo k argumentům MSBuildu + + Use current runtime as the target runtime. + Use current runtime as the target runtime. + + SOURCE SOURCE diff --git a/src/Cli/dotnet/commands/dotnet-restore/xlf/LocalizableStrings.de.xlf b/src/Cli/dotnet/commands/dotnet-restore/xlf/LocalizableStrings.de.xlf index 22e633cb3e42..d7c035765fa2 100644 --- a/src/Cli/dotnet/commands/dotnet-restore/xlf/LocalizableStrings.de.xlf +++ b/src/Cli/dotnet/commands/dotnet-restore/xlf/LocalizableStrings.de.xlf @@ -22,6 +22,11 @@ Optionaler Pfad zu einer Projektdatei oder MSBuild-Argumente. + + Use current runtime as the target runtime. + Use current runtime as the target runtime. + + SOURCE SOURCE diff --git a/src/Cli/dotnet/commands/dotnet-restore/xlf/LocalizableStrings.es.xlf b/src/Cli/dotnet/commands/dotnet-restore/xlf/LocalizableStrings.es.xlf index 1b6d8f93920b..0124b0bbb1ce 100644 --- a/src/Cli/dotnet/commands/dotnet-restore/xlf/LocalizableStrings.es.xlf +++ b/src/Cli/dotnet/commands/dotnet-restore/xlf/LocalizableStrings.es.xlf @@ -22,6 +22,11 @@ Ruta de acceso opcional a un archivo de proyecto o argumentos de MSBuild. + + Use current runtime as the target runtime. + Use current runtime as the target runtime. + + SOURCE ORIGEN diff --git a/src/Cli/dotnet/commands/dotnet-restore/xlf/LocalizableStrings.fr.xlf b/src/Cli/dotnet/commands/dotnet-restore/xlf/LocalizableStrings.fr.xlf index 0e4abbcc07b2..ffc82f70ad14 100644 --- a/src/Cli/dotnet/commands/dotnet-restore/xlf/LocalizableStrings.fr.xlf +++ b/src/Cli/dotnet/commands/dotnet-restore/xlf/LocalizableStrings.fr.xlf @@ -22,6 +22,11 @@ Chemin facultatif vers un fichier projet ou des arguments MSBuild. + + Use current runtime as the target runtime. + Use current runtime as the target runtime. + + SOURCE SOURCE diff --git a/src/Cli/dotnet/commands/dotnet-restore/xlf/LocalizableStrings.it.xlf b/src/Cli/dotnet/commands/dotnet-restore/xlf/LocalizableStrings.it.xlf index ed65e02e51a3..636654b6e08d 100644 --- a/src/Cli/dotnet/commands/dotnet-restore/xlf/LocalizableStrings.it.xlf +++ b/src/Cli/dotnet/commands/dotnet-restore/xlf/LocalizableStrings.it.xlf @@ -22,6 +22,11 @@ Percorso facoltativo di un file di progetto o di argomenti di MSBuild. + + Use current runtime as the target runtime. + Use current runtime as the target runtime. + + SOURCE ORIGINE diff --git a/src/Cli/dotnet/commands/dotnet-restore/xlf/LocalizableStrings.ja.xlf b/src/Cli/dotnet/commands/dotnet-restore/xlf/LocalizableStrings.ja.xlf index 14cf3e27f33f..f86483e8db88 100644 --- a/src/Cli/dotnet/commands/dotnet-restore/xlf/LocalizableStrings.ja.xlf +++ b/src/Cli/dotnet/commands/dotnet-restore/xlf/LocalizableStrings.ja.xlf @@ -22,6 +22,11 @@ プロジェクト ファイルまたは MSBuild 引数へのオプションのパス。 + + Use current runtime as the target runtime. + Use current runtime as the target runtime. + + SOURCE SOURCE diff --git a/src/Cli/dotnet/commands/dotnet-restore/xlf/LocalizableStrings.ko.xlf b/src/Cli/dotnet/commands/dotnet-restore/xlf/LocalizableStrings.ko.xlf index ffb48372fb51..f98b929c7c0e 100644 --- a/src/Cli/dotnet/commands/dotnet-restore/xlf/LocalizableStrings.ko.xlf +++ b/src/Cli/dotnet/commands/dotnet-restore/xlf/LocalizableStrings.ko.xlf @@ -22,6 +22,11 @@ 프로젝트 파일의 선택적 경로 또는 MSBuild 인수입니다. + + Use current runtime as the target runtime. + Use current runtime as the target runtime. + + SOURCE SOURCE diff --git a/src/Cli/dotnet/commands/dotnet-restore/xlf/LocalizableStrings.pl.xlf b/src/Cli/dotnet/commands/dotnet-restore/xlf/LocalizableStrings.pl.xlf index c9f2065f4db2..0f82ecb00986 100644 --- a/src/Cli/dotnet/commands/dotnet-restore/xlf/LocalizableStrings.pl.xlf +++ b/src/Cli/dotnet/commands/dotnet-restore/xlf/LocalizableStrings.pl.xlf @@ -22,6 +22,11 @@ Opcjonalna ścieżka do pliku projektu lub argumentów programu MSBuild. + + Use current runtime as the target runtime. + Use current runtime as the target runtime. + + SOURCE ŹRÓDŁO diff --git a/src/Cli/dotnet/commands/dotnet-restore/xlf/LocalizableStrings.pt-BR.xlf b/src/Cli/dotnet/commands/dotnet-restore/xlf/LocalizableStrings.pt-BR.xlf index c88e390a1f2a..6fadea8d742e 100644 --- a/src/Cli/dotnet/commands/dotnet-restore/xlf/LocalizableStrings.pt-BR.xlf +++ b/src/Cli/dotnet/commands/dotnet-restore/xlf/LocalizableStrings.pt-BR.xlf @@ -22,6 +22,11 @@ Caminho opcional para um arquivo de projeto ou argumentos do MSBuild. + + Use current runtime as the target runtime. + Use current runtime as the target runtime. + + SOURCE ORIGEM diff --git a/src/Cli/dotnet/commands/dotnet-restore/xlf/LocalizableStrings.ru.xlf b/src/Cli/dotnet/commands/dotnet-restore/xlf/LocalizableStrings.ru.xlf index cf029469d9ce..2a20a0400ab1 100644 --- a/src/Cli/dotnet/commands/dotnet-restore/xlf/LocalizableStrings.ru.xlf +++ b/src/Cli/dotnet/commands/dotnet-restore/xlf/LocalizableStrings.ru.xlf @@ -22,6 +22,11 @@ Дополнительный путь к файлу проекта или аргументам MSBuild. + + Use current runtime as the target runtime. + Use current runtime as the target runtime. + + SOURCE SOURCE diff --git a/src/Cli/dotnet/commands/dotnet-restore/xlf/LocalizableStrings.tr.xlf b/src/Cli/dotnet/commands/dotnet-restore/xlf/LocalizableStrings.tr.xlf index 9dcd63eb2d8f..49aa5f38affa 100644 --- a/src/Cli/dotnet/commands/dotnet-restore/xlf/LocalizableStrings.tr.xlf +++ b/src/Cli/dotnet/commands/dotnet-restore/xlf/LocalizableStrings.tr.xlf @@ -22,6 +22,11 @@ Proje dosyasının veya MSBuild bağımsız değişkenlerinin isteğe bağlı yolu. + + Use current runtime as the target runtime. + Use current runtime as the target runtime. + + SOURCE SOURCE diff --git a/src/Cli/dotnet/commands/dotnet-restore/xlf/LocalizableStrings.zh-Hans.xlf b/src/Cli/dotnet/commands/dotnet-restore/xlf/LocalizableStrings.zh-Hans.xlf index eebc5721c835..44f79d334a21 100644 --- a/src/Cli/dotnet/commands/dotnet-restore/xlf/LocalizableStrings.zh-Hans.xlf +++ b/src/Cli/dotnet/commands/dotnet-restore/xlf/LocalizableStrings.zh-Hans.xlf @@ -22,6 +22,11 @@ 项目文件或 MSBuild 参数的可选路径。 + + Use current runtime as the target runtime. + Use current runtime as the target runtime. + + SOURCE SOURCE diff --git a/src/Cli/dotnet/commands/dotnet-restore/xlf/LocalizableStrings.zh-Hant.xlf b/src/Cli/dotnet/commands/dotnet-restore/xlf/LocalizableStrings.zh-Hant.xlf index 14fdc8930925..b749ee21391a 100644 --- a/src/Cli/dotnet/commands/dotnet-restore/xlf/LocalizableStrings.zh-Hant.xlf +++ b/src/Cli/dotnet/commands/dotnet-restore/xlf/LocalizableStrings.zh-Hant.xlf @@ -22,6 +22,11 @@ 專案檔或 MSBuild 引數的選擇性路徑。 + + Use current runtime as the target runtime. + Use current runtime as the target runtime. + + SOURCE SOURCE diff --git a/src/Cli/dotnet/commands/dotnet-store/LocalizableStrings.resx b/src/Cli/dotnet/commands/dotnet-store/LocalizableStrings.resx index d5ba610aced7..5962d22437e1 100644 --- a/src/Cli/dotnet/commands/dotnet-store/LocalizableStrings.resx +++ b/src/Cli/dotnet/commands/dotnet-store/LocalizableStrings.resx @@ -1,17 +1,17 @@  - @@ -162,4 +162,7 @@ The target runtime to store packages for. - \ No newline at end of file + + Use current runtime as the target runtime. + + diff --git a/src/Cli/dotnet/commands/dotnet-store/StoreCommandParser.cs b/src/Cli/dotnet/commands/dotnet-store/StoreCommandParser.cs index ca47c26b6388..c966d816d23d 100644 --- a/src/Cli/dotnet/commands/dotnet-store/StoreCommandParser.cs +++ b/src/Cli/dotnet/commands/dotnet-store/StoreCommandParser.cs @@ -50,6 +50,7 @@ public static Command Store() => .With(name: LocalizableStrings.FrameworkVersionOption) .ForwardAsSingle(o => $"-property:RuntimeFrameworkVersion={o.Arguments.Single()}")), CommonOptions.RuntimeOption(LocalizableStrings.RuntimeOptionDescription), + CommonOptions.CurrentRuntimeOption(LocalizableStrings.CurrentRuntimeOptionDescription), Create.Option( "-o|--output", LocalizableStrings.OutputOptionDescription, diff --git a/src/Cli/dotnet/commands/dotnet-store/xlf/LocalizableStrings.cs.xlf b/src/Cli/dotnet/commands/dotnet-store/xlf/LocalizableStrings.cs.xlf index 5694cdb1e7e8..52deb7dc814e 100644 --- a/src/Cli/dotnet/commands/dotnet-store/xlf/LocalizableStrings.cs.xlf +++ b/src/Cli/dotnet/commands/dotnet-store/xlf/LocalizableStrings.cs.xlf @@ -7,6 +7,11 @@ Uloží určená sestavení pro platformu .NET. Standardně se optimalizují pro cílový modul runtime a architekturu. + + Use current runtime as the target runtime. + Use current runtime as the target runtime. + + OUTPUT_DIR OUTPUT_DIR diff --git a/src/Cli/dotnet/commands/dotnet-store/xlf/LocalizableStrings.de.xlf b/src/Cli/dotnet/commands/dotnet-store/xlf/LocalizableStrings.de.xlf index 074ce426fdbe..ecbdb818ff54 100644 --- a/src/Cli/dotnet/commands/dotnet-store/xlf/LocalizableStrings.de.xlf +++ b/src/Cli/dotnet/commands/dotnet-store/xlf/LocalizableStrings.de.xlf @@ -7,6 +7,11 @@ Speichert die angegebenen Assemblys für die .NET-Plattform. Standardmäßig werden diese für die Zielruntime und das Framework optimiert. + + Use current runtime as the target runtime. + Use current runtime as the target runtime. + + OUTPUT_DIR OUTPUT_DIR diff --git a/src/Cli/dotnet/commands/dotnet-store/xlf/LocalizableStrings.es.xlf b/src/Cli/dotnet/commands/dotnet-store/xlf/LocalizableStrings.es.xlf index 30516f5444f7..ff9c2cdca213 100644 --- a/src/Cli/dotnet/commands/dotnet-store/xlf/LocalizableStrings.es.xlf +++ b/src/Cli/dotnet/commands/dotnet-store/xlf/LocalizableStrings.es.xlf @@ -7,6 +7,11 @@ Almacena los ensamblados especificados para la plataforma .NET. De forma predeterminada, estos se optimizarán para el tiempo de ejecución y la plataforma de destino. + + Use current runtime as the target runtime. + Use current runtime as the target runtime. + + OUTPUT_DIR DIRECTORIO_DE_SALIDA diff --git a/src/Cli/dotnet/commands/dotnet-store/xlf/LocalizableStrings.fr.xlf b/src/Cli/dotnet/commands/dotnet-store/xlf/LocalizableStrings.fr.xlf index b6c92caa3fe5..825b0cf68e58 100644 --- a/src/Cli/dotnet/commands/dotnet-store/xlf/LocalizableStrings.fr.xlf +++ b/src/Cli/dotnet/commands/dotnet-store/xlf/LocalizableStrings.fr.xlf @@ -7,6 +7,11 @@ Stocke les assemblys spécifiés pour la plateforme .NET. Par défaut, ceux-ci sont optimisés pour le runtime et le framework cible. + + Use current runtime as the target runtime. + Use current runtime as the target runtime. + + OUTPUT_DIR OUTPUT_DIR diff --git a/src/Cli/dotnet/commands/dotnet-store/xlf/LocalizableStrings.it.xlf b/src/Cli/dotnet/commands/dotnet-store/xlf/LocalizableStrings.it.xlf index b5d1a893b19c..65183b33753f 100644 --- a/src/Cli/dotnet/commands/dotnet-store/xlf/LocalizableStrings.it.xlf +++ b/src/Cli/dotnet/commands/dotnet-store/xlf/LocalizableStrings.it.xlf @@ -7,6 +7,11 @@ Consente di archiviare gli assembly specificati per la piattaforma .NET. Per impostazione predefinita, gli assembly verranno ottimizzati per il framework e il runtime di destinazione. + + Use current runtime as the target runtime. + Use current runtime as the target runtime. + + OUTPUT_DIR DIR_OUTPUT diff --git a/src/Cli/dotnet/commands/dotnet-store/xlf/LocalizableStrings.ja.xlf b/src/Cli/dotnet/commands/dotnet-store/xlf/LocalizableStrings.ja.xlf index 4bdc8f7a4dd6..33bbf67f3c85 100644 --- a/src/Cli/dotnet/commands/dotnet-store/xlf/LocalizableStrings.ja.xlf +++ b/src/Cli/dotnet/commands/dotnet-store/xlf/LocalizableStrings.ja.xlf @@ -7,6 +7,11 @@ .NET Platform の指定されたアセンブリを格納します。既定では、これらはターゲットのランタイムとフレームワーク用に最適化されます。 + + Use current runtime as the target runtime. + Use current runtime as the target runtime. + + OUTPUT_DIR OUTPUT_DIR diff --git a/src/Cli/dotnet/commands/dotnet-store/xlf/LocalizableStrings.ko.xlf b/src/Cli/dotnet/commands/dotnet-store/xlf/LocalizableStrings.ko.xlf index 410ea9fcaa34..3900b7239040 100644 --- a/src/Cli/dotnet/commands/dotnet-store/xlf/LocalizableStrings.ko.xlf +++ b/src/Cli/dotnet/commands/dotnet-store/xlf/LocalizableStrings.ko.xlf @@ -7,6 +7,11 @@ .NET 플랫폼에 대해 지정된 어셈블리를 저장합니다. 기본적으로 대상 런타임 및 프레임워크에 대해 최적화됩니다. + + Use current runtime as the target runtime. + Use current runtime as the target runtime. + + OUTPUT_DIR OUTPUT_DIR diff --git a/src/Cli/dotnet/commands/dotnet-store/xlf/LocalizableStrings.pl.xlf b/src/Cli/dotnet/commands/dotnet-store/xlf/LocalizableStrings.pl.xlf index 2260d96218df..69f4567a52ef 100644 --- a/src/Cli/dotnet/commands/dotnet-store/xlf/LocalizableStrings.pl.xlf +++ b/src/Cli/dotnet/commands/dotnet-store/xlf/LocalizableStrings.pl.xlf @@ -7,6 +7,11 @@ Przechowuje określone zestawy platformy .NET. Domyślnie są one optymalizowane pod kątem docelowego środowiska uruchomieniowego i platformy docelowej. + + Use current runtime as the target runtime. + Use current runtime as the target runtime. + + OUTPUT_DIR KATALOG_WYJŚCIOWY diff --git a/src/Cli/dotnet/commands/dotnet-store/xlf/LocalizableStrings.pt-BR.xlf b/src/Cli/dotnet/commands/dotnet-store/xlf/LocalizableStrings.pt-BR.xlf index e51aed761ecd..fe0a56cde0d2 100644 --- a/src/Cli/dotnet/commands/dotnet-store/xlf/LocalizableStrings.pt-BR.xlf +++ b/src/Cli/dotnet/commands/dotnet-store/xlf/LocalizableStrings.pt-BR.xlf @@ -7,6 +7,11 @@ Armazena os assemblies especificados para a Plataforma .NET. Por padrão, serão otimizados para o runtime e a estrutura de destino. + + Use current runtime as the target runtime. + Use current runtime as the target runtime. + + OUTPUT_DIR OUTPUT_DIR diff --git a/src/Cli/dotnet/commands/dotnet-store/xlf/LocalizableStrings.ru.xlf b/src/Cli/dotnet/commands/dotnet-store/xlf/LocalizableStrings.ru.xlf index 489a1bfbb944..bc2a8ca94e47 100644 --- a/src/Cli/dotnet/commands/dotnet-store/xlf/LocalizableStrings.ru.xlf +++ b/src/Cli/dotnet/commands/dotnet-store/xlf/LocalizableStrings.ru.xlf @@ -7,6 +7,11 @@ Хранит указанные сборки для платформы .NET. По умолчанию они оптимизируются для целевой среды выполнения и платформы. + + Use current runtime as the target runtime. + Use current runtime as the target runtime. + + OUTPUT_DIR OUTPUT_DIR diff --git a/src/Cli/dotnet/commands/dotnet-store/xlf/LocalizableStrings.tr.xlf b/src/Cli/dotnet/commands/dotnet-store/xlf/LocalizableStrings.tr.xlf index d62064e3ccc4..70c27b0be9eb 100644 --- a/src/Cli/dotnet/commands/dotnet-store/xlf/LocalizableStrings.tr.xlf +++ b/src/Cli/dotnet/commands/dotnet-store/xlf/LocalizableStrings.tr.xlf @@ -7,6 +7,11 @@ .NET Platformu için belirtilen bütünleştirilmiş kodları depolar. Varsayılan olarak, bunlar hedef çalışma zamanı ve çerçeve için iyileştirilir. + + Use current runtime as the target runtime. + Use current runtime as the target runtime. + + OUTPUT_DIR ÇIKIŞ_DİZİNİ diff --git a/src/Cli/dotnet/commands/dotnet-store/xlf/LocalizableStrings.zh-Hans.xlf b/src/Cli/dotnet/commands/dotnet-store/xlf/LocalizableStrings.zh-Hans.xlf index f0dd99ee6fdb..9bce22cf4f84 100644 --- a/src/Cli/dotnet/commands/dotnet-store/xlf/LocalizableStrings.zh-Hans.xlf +++ b/src/Cli/dotnet/commands/dotnet-store/xlf/LocalizableStrings.zh-Hans.xlf @@ -7,6 +7,11 @@ 存储为 .NET 平台指定的程序集。默认情况下,这些程序集将针对目标运行时和框架进行优化。 + + Use current runtime as the target runtime. + Use current runtime as the target runtime. + + OUTPUT_DIR OUTPUT_DIR diff --git a/src/Cli/dotnet/commands/dotnet-store/xlf/LocalizableStrings.zh-Hant.xlf b/src/Cli/dotnet/commands/dotnet-store/xlf/LocalizableStrings.zh-Hant.xlf index 3566305b6611..24d291de39ce 100644 --- a/src/Cli/dotnet/commands/dotnet-store/xlf/LocalizableStrings.zh-Hant.xlf +++ b/src/Cli/dotnet/commands/dotnet-store/xlf/LocalizableStrings.zh-Hant.xlf @@ -7,6 +7,11 @@ 儲存為 .NET 平台所指定的組件。根據預設,會為目標執行階段與架構,最佳化這些組件。 + + Use current runtime as the target runtime. + Use current runtime as the target runtime. + + OUTPUT_DIR OUTPUT_DIR diff --git a/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.RuntimeIdentifierInference.targets b/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.RuntimeIdentifierInference.targets index 5d479840d2b3..508f1ab65308 100644 --- a/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.RuntimeIdentifierInference.targets +++ b/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.RuntimeIdentifierInference.targets @@ -6,7 +6,7 @@ WARNING: DO NOT MODIFY this file unless you are knowledgeable about MSBuild and created a backup copy. Incorrect changes to this file will make it impossible to load or build your projects from the command-line or the IDE. -Copyright (c) .NET Foundation. All rights reserved. +Copyright (c) .NET Foundation. All rights reserved. *********************************************************************************************** --> @@ -52,8 +52,8 @@ Copyright (c) .NET Foundation. All rights reserved. work without user intervention. The current static evaluation requirement limits us. --> - <_UsingDefaultRuntimeIdentifier>true @@ -61,6 +61,10 @@ Copyright (c) .NET Foundation. All rights reserved. win7-x86 + + $(NETCoreSdkRuntimeIdentifier) + + <_UsingDefaultPlatformTarget>true @@ -96,7 +100,7 @@ Copyright (c) .NET Foundation. All rights reserved. @@ -224,9 +228,9 @@ Copyright (c) .NET Foundation. All rights reserved. AssemblyFile="$(MicrosoftNETBuildTasksAssembly)" /> - - + diff --git a/src/Tests/Microsoft.NET.Publish.Tests/RuntimeIdentifiersTests.cs b/src/Tests/Microsoft.NET.Publish.Tests/RuntimeIdentifiersTests.cs index d35097478a9f..37fb41607a53 100644 --- a/src/Tests/Microsoft.NET.Publish.Tests/RuntimeIdentifiersTests.cs +++ b/src/Tests/Microsoft.NET.Publish.Tests/RuntimeIdentifiersTests.cs @@ -1,6 +1,10 @@ -using System; +// Copyright (c) .NET Foundation and contributors. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +using System; using System.Collections.Generic; using System.IO; +using System.Linq; using System.Text; using FluentAssertions; using Microsoft.DotNet.Cli.Utils; @@ -79,6 +83,47 @@ public void BuildWithRuntimeIdentifier() } } + [Fact] + public void BuildWithUseCurrentRuntimeIdentifier() + { + var testProject = new TestProject() + { + Name = "BuildWithUseCurrentRuntimeIdentifier", + TargetFrameworks = "netcoreapp3.0", + IsSdkProject = true, + IsExe = true + }; + + var compatibleRid = EnvironmentInfo.GetCompatibleRid(testProject.TargetFrameworks); + + testProject.AdditionalProperties["UseCurrentRuntimeIdentifier"] = "True"; + + // Use a test-specific packages folder + testProject.AdditionalProperties["RestorePackagesPath"] = @"$(MSBuildProjectDirectory)\..\pkg"; + + var testAsset = _testAssetsManager.CreateTestProject(testProject); + var buildCommand = new BuildCommand(testAsset); + + buildCommand + .Execute() + .Should() + .Pass(); + + string targetFrameworkOutputDirectory = Path.Combine(buildCommand.GetNonSDKOutputDirectory().FullName, testProject.TargetFrameworks); + string outputDirectoryWithRuntimeIdentifier = Directory.EnumerateDirectories(targetFrameworkOutputDirectory, "*", SearchOption.AllDirectories).FirstOrDefault(); + outputDirectoryWithRuntimeIdentifier.Should().NotBeNullOrWhiteSpace(); + + var selfContainedExecutable = $"{testProject.Name}{Constants.ExeSuffix}"; + string selfContainedExecutableFullPath = Path.Combine(outputDirectoryWithRuntimeIdentifier, selfContainedExecutable); + + new RunExeCommand(Log, selfContainedExecutableFullPath) + .Execute() + .Should() + .Pass() + .And + .HaveStdOutContaining("Hello World!"); + } + // Run on core MSBuild only as using a local packages folder hits long path issues on full MSBuild [CoreMSBuildOnlyTheory] [InlineData(false)] diff --git a/src/Tests/dotnet.Tests/dotnet-msbuild/GivenDotnetBuildInvocation.cs b/src/Tests/dotnet.Tests/dotnet-msbuild/GivenDotnetBuildInvocation.cs index f574af8d00c8..33ea76a3eb98 100644 --- a/src/Tests/dotnet.Tests/dotnet-msbuild/GivenDotnetBuildInvocation.cs +++ b/src/Tests/dotnet.Tests/dotnet-msbuild/GivenDotnetBuildInvocation.cs @@ -1,4 +1,4 @@ -// Copyright (c) .NET Foundation and contributors. All rights reserved. +// Copyright (c) .NET Foundation and contributors. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. using System.IO; @@ -13,7 +13,7 @@ public class GivenDotnetBuildInvocation : IClassFixturemyoutput -verbosity:diag /ArbitrarySwitchForMSBuild", "-property:OutputPath=myoutput -property:TargetFramework=tfm -verbosity:diag /ArbitrarySwitchForMSBuild")] public void MsbuildInvocationIsCorrectForSeparateRestore( - string[] args, - string expectedAdditionalArgsForRestore, + string[] args, + string expectedAdditionalArgsForRestore, string expectedAdditionalArgs) { CommandDirectoryContext.PerformActionWithBasePath(WorkingDirectory, () => diff --git a/src/Tests/dotnet.Tests/dotnet-msbuild/GivenDotnetPublishInvocation.cs b/src/Tests/dotnet.Tests/dotnet-msbuild/GivenDotnetPublishInvocation.cs index 2efb34136b26..47576546968e 100644 --- a/src/Tests/dotnet.Tests/dotnet-msbuild/GivenDotnetPublishInvocation.cs +++ b/src/Tests/dotnet.Tests/dotnet-msbuild/GivenDotnetPublishInvocation.cs @@ -1,10 +1,10 @@ -// Copyright (c) .NET Foundation and contributors. All rights reserved. +// Copyright (c) .NET Foundation and contributors. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. using System; using System.IO; -using FluentAssertions; using System.Linq; +using FluentAssertions; using Microsoft.DotNet.Cli.CommandLine; using Microsoft.DotNet.Tools.Publish; using Xunit; @@ -14,7 +14,7 @@ namespace Microsoft.DotNet.Cli.MSBuild.Tests { public class GivenDotnetPublishInvocation : IClassFixture { - private static readonly string WorkingDirectory = + private static readonly string WorkingDirectory = TestPathUtilities.FormatAbsolutePath(nameof(GivenDotnetPublishInvocation)); private readonly ITestOutputHelper output; @@ -29,6 +29,7 @@ public GivenDotnetPublishInvocation(ITestOutputHelper output) [InlineData(new string[] { }, "")] [InlineData(new string[] { "-r", "" }, "-property:RuntimeIdentifier=")] [InlineData(new string[] { "--runtime", "" }, "-property:RuntimeIdentifier=")] + [InlineData(new string[] { "--use-current-runtime" }, "-property:UseCurrentRuntimeIdentifier=True")] [InlineData(new string[] { "-o", "" }, "-property:PublishDir=")] [InlineData(new string[] { "--output", "" }, "-property:PublishDir=")] [InlineData(new string[] { "-c", "" }, "-property:Configuration=")] @@ -103,6 +104,7 @@ public void MsbuildInvocationIsCorrectForNoBuild() [InlineData(new string[] { "--framework", "" }, "-property:TargetFramework=")] [InlineData(new string[] { "-r", "" }, "-property:RuntimeIdentifier=")] [InlineData(new string[] { "--runtime", "" }, "-property:RuntimeIdentifier=")] + [InlineData(new string[] { "--use-current-runtime" }, "-property:UseCurrentRuntimeIdentifier=True")] [InlineData(new string[] { "-o", "" }, "-property:PublishDir=")] [InlineData(new string[] { "--output", "" }, "-property:PublishDir=")] [InlineData(new string[] { "-c", "" }, "-property:Configuration=")] diff --git a/src/Tests/dotnet.Tests/dotnet-msbuild/GivenDotnetStoreInvocation.cs b/src/Tests/dotnet.Tests/dotnet-msbuild/GivenDotnetStoreInvocation.cs index 6512e0edcb6a..3d0af3f96baa 100644 --- a/src/Tests/dotnet.Tests/dotnet-msbuild/GivenDotnetStoreInvocation.cs +++ b/src/Tests/dotnet.Tests/dotnet-msbuild/GivenDotnetStoreInvocation.cs @@ -1,4 +1,4 @@ -// Copyright (c) .NET Foundation and contributors. All rights reserved. +// Copyright (c) .NET Foundation and contributors. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. using FluentAssertions; @@ -14,7 +14,7 @@ public class GivenDotnetStoreInvocation : IClassFixture" }; - private static readonly string WorkingDirectory = + private static readonly string WorkingDirectory = TestPathUtilities.FormatAbsolutePath(nameof(GivenDotnetStoreInvocation)); [Theory] @@ -33,6 +33,7 @@ public void ItAddsProjectToMsbuildInvocation(string optionName) [InlineData(new string[] { "--framework", "" }, @"-property:TargetFramework=")] [InlineData(new string[] { "-r", "" }, @"-property:RuntimeIdentifier=")] [InlineData(new string[] { "--runtime", "" }, @"-property:RuntimeIdentifier=")] + [InlineData(new string[] { "--use-current-runtime" }, "-property:UseCurrentRuntimeIdentifier=True")] [InlineData(new string[] { "--manifest", "one.xml", "--manifest", "two.xml", "--manifest", "three.xml" }, @"-property:AdditionalProjects=one.xml%3Btwo.xml%3Bthree.xml")] public void MsbuildInvocationIsCorrect(string[] args, string expectedAdditionalArgs) {