diff --git a/Directory.Build.props b/Directory.Build.props index ee780122bdb..59bb21b50f8 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -27,6 +27,9 @@ true false + + + net472 diff --git a/Directory.Packages.props b/Directory.Packages.props index 467cccdce2e..2d0b4eb441a 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -16,17 +16,17 @@ - - - + + + - - - + + + @@ -58,12 +58,4 @@ - - - - - - - - \ No newline at end of file diff --git a/azure-pipelines-pr.yml b/azure-pipelines-pr.yml index 3e634557776..6131b23c6de 100644 --- a/azure-pipelines-pr.yml +++ b/azure-pipelines-pr.yml @@ -51,7 +51,7 @@ stages: enablePublishTestResults: true enablePublishBuildAssets: true enablePublishUsingPipelines: ${{ variables._PublishUsingPipelines }} - enableSourceBuild: true + enableSourceBuild: false sourceBuildParameters: enableInternalSources: true enableTelemetry: true diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 0dedd7ddbf3..4ec60dc773e 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -78,7 +78,7 @@ extends: enablePublishTestResults: true enablePublishBuildAssets: true enablePublishUsingPipelines: ${{ variables._PublishUsingPipelines }} - enableSourceBuild: true + enableSourceBuild: false publishAssetsImmediately: true sourceBuildParameters: enableInternalSources: true diff --git a/eng/SourceBuildPrebuiltBaseline.xml b/eng/SourceBuildPrebuiltBaseline.xml index a7a1c985da6..413f86d6cc2 100644 --- a/eng/SourceBuildPrebuiltBaseline.xml +++ b/eng/SourceBuildPrebuiltBaseline.xml @@ -5,5 +5,10 @@ + + + + + diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 45b4243f623..79a9fa553f4 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -8,9 +8,9 @@ - + https://github.com/dotnet/source-build-reference-packages - 1b838a42e4952b8fdf212cb1b43c5ce4d69f27b3 + 643689c88b1d5a0f1561383972c4189a0c673abe @@ -19,14 +19,14 @@ - + https://github.com/dotnet/arcade - f33d9e642f0e68a61312164cd9e0baf4e142a999 + aa61e8c20a869bcc994f8b29eb07d927d2bec6f4 - + https://github.com/dotnet/arcade - f33d9e642f0e68a61312164cd9e0baf4e142a999 + aa61e8c20a869bcc994f8b29eb07d927d2bec6f4 @@ -34,21 +34,21 @@ https://github.com/dotnet/runtime d3981726bc8b0e179db50301daf9f22d42393096 - + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - 9d5a6a9aa463d6d10b0b0ba6d5982cc82f363dc3 + 831d23e56149cd59c40fc00c7feb7c5334bd19c4 - + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - 9d5a6a9aa463d6d10b0b0ba6d5982cc82f363dc3 + 831d23e56149cd59c40fc00c7feb7c5334bd19c4 - + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - 9d5a6a9aa463d6d10b0b0ba6d5982cc82f363dc3 + 831d23e56149cd59c40fc00c7feb7c5334bd19c4 - + https://github.com/dotnet/runtime - 9d5a6a9aa463d6d10b0b0ba6d5982cc82f363dc3 + 831d23e56149cd59c40fc00c7feb7c5334bd19c4 diff --git a/eng/Versions.props b/eng/Versions.props index 1322948fd94..d3976abf4c4 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -1,6 +1,6 @@ - 9.0.203 + 9.0.300 true release @@ -20,9 +20,9 @@ 9.0.0 - 9.0.0 - 9.0.0 - 9.0.0 - 9.0.0 + 9.0.3 + 9.0.3 + 9.0.3 + 9.0.3 diff --git a/eng/common/sdl/packages.config b/eng/common/sdl/packages.config index 4585cfd6bba..e5f543ea68c 100644 --- a/eng/common/sdl/packages.config +++ b/eng/common/sdl/packages.config @@ -1,4 +1,4 @@ - + diff --git a/eng/common/tools.ps1 b/eng/common/tools.ps1 index a46b6deb759..22b49e09d09 100644 --- a/eng/common/tools.ps1 +++ b/eng/common/tools.ps1 @@ -42,7 +42,7 @@ [bool]$useInstalledDotNetCli = if (Test-Path variable:useInstalledDotNetCli) { $useInstalledDotNetCli } else { $true } # Enable repos to use a particular version of the on-line dotnet-install scripts. -# default URL: https://dotnet.microsoft.com/download/dotnet/scripts/v1/dotnet-install.ps1 +# default URL: https://builds.dotnet.microsoft.com/dotnet/scripts/v1/dotnet-install.ps1 [string]$dotnetInstallScriptVersion = if (Test-Path variable:dotnetInstallScriptVersion) { $dotnetInstallScriptVersion } else { 'v1' } # True to use global NuGet cache instead of restoring packages to repository-local directory. @@ -262,7 +262,7 @@ function GetDotNetInstallScript([string] $dotnetRoot) { if (!(Test-Path $installScript)) { Create-Directory $dotnetRoot $ProgressPreference = 'SilentlyContinue' # Don't display the console progress UI - it's a huge perf hit - $uri = "https://dotnet.microsoft.com/download/dotnet/scripts/$dotnetInstallScriptVersion/dotnet-install.ps1" + $uri = "https://builds.dotnet.microsoft.com/dotnet/scripts/$dotnetInstallScriptVersion/dotnet-install.ps1" Retry({ Write-Host "GET $uri" diff --git a/eng/common/tools.sh b/eng/common/tools.sh index 1159726a10f..01b09b65796 100755 --- a/eng/common/tools.sh +++ b/eng/common/tools.sh @@ -54,7 +54,7 @@ warn_as_error=${warn_as_error:-true} use_installed_dotnet_cli=${use_installed_dotnet_cli:-true} # Enable repos to use a particular version of the on-line dotnet-install scripts. -# default URL: https://dotnet.microsoft.com/download/dotnet/scripts/v1/dotnet-install.sh +# default URL: https://builds.dotnet.microsoft.com/dotnet/scripts/v1/dotnet-install.sh dotnetInstallScriptVersion=${dotnetInstallScriptVersion:-'v1'} # True to use global NuGet cache instead of restoring packages to repository-local directory. @@ -295,7 +295,7 @@ function with_retries { function GetDotNetInstallScript { local root=$1 local install_script="$root/dotnet-install.sh" - local install_script_url="https://dotnet.microsoft.com/download/dotnet/scripts/$dotnetInstallScriptVersion/dotnet-install.sh" + local install_script_url="https://builds.dotnet.microsoft.com/dotnet/scripts/$dotnetInstallScriptVersion/dotnet-install.sh" if [[ ! -a "$install_script" ]]; then mkdir -p "$root" diff --git a/global.json b/global.json index 492c189bedd..5538c45d212 100644 --- a/global.json +++ b/global.json @@ -1,8 +1,8 @@ { "tools": { - "dotnet": "9.0.104" + "dotnet": "9.0.105" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "9.0.0-beta.25161.4" + "Microsoft.DotNet.Arcade.Sdk": "9.0.0-beta.25208.6" } } diff --git a/src/Microsoft.TemplateEngine.Orchestrator.RunnableProjects/ParameterConverter.cs b/src/Microsoft.TemplateEngine.Orchestrator.RunnableProjects/ParameterConverter.cs index d95ab92aa46..d2e27981fee 100644 --- a/src/Microsoft.TemplateEngine.Orchestrator.RunnableProjects/ParameterConverter.cs +++ b/src/Microsoft.TemplateEngine.Orchestrator.RunnableProjects/ParameterConverter.cs @@ -188,6 +188,7 @@ private static bool TryResolveChoiceValue(string? literal, ITemplateParameter pa } string? partialMatch = null; + bool multiplePartialMatches = false; foreach (string choiceValue in param.Choices.Keys) { @@ -205,13 +206,19 @@ private static bool TryResolveChoiceValue(string? literal, ITemplateParameter pa } else { - // multiple partial matches, can't take one. - match = null; - return false; + // Multiple partial matches, keep searching for exact match, fail if we don't find one + // because we don't know which partial match we should select. + multiplePartialMatches = true; } } } + if (multiplePartialMatches) + { + match = null; + return false; + } + match = partialMatch; return match != null; } diff --git a/test/Microsoft.TemplateEngine.IDE.IntegrationTests/Microsoft.TemplateEngine.IDE.IntegrationTests.csproj b/test/Microsoft.TemplateEngine.IDE.IntegrationTests/Microsoft.TemplateEngine.IDE.IntegrationTests.csproj index d98b24394ef..4fcd29c1e6d 100644 --- a/test/Microsoft.TemplateEngine.IDE.IntegrationTests/Microsoft.TemplateEngine.IDE.IntegrationTests.csproj +++ b/test/Microsoft.TemplateEngine.IDE.IntegrationTests/Microsoft.TemplateEngine.IDE.IntegrationTests.csproj @@ -1,7 +1,7 @@ - $(NetCurrent);$(NetFrameworkCurrent) + $(NetCurrent);net481 diff --git a/test/Microsoft.TemplateEngine.Orchestrator.RunnableProjects.UnitTests/Approvals/TestSelectionForMultiChoicesWhenThereAreMultiplePartialMatchesAndOnePreciseMatch._.verified/TestAssets.TemplateWithMultipleChoicesAndPartialMatches/Program.cs b/test/Microsoft.TemplateEngine.Orchestrator.RunnableProjects.UnitTests/Approvals/TestSelectionForMultiChoicesWhenThereAreMultiplePartialMatchesAndOnePreciseMatch._.verified/TestAssets.TemplateWithMultipleChoicesAndPartialMatches/Program.cs new file mode 100644 index 00000000000..fe6dc114ffe --- /dev/null +++ b/test/Microsoft.TemplateEngine.Orchestrator.RunnableProjects.UnitTests/Approvals/TestSelectionForMultiChoicesWhenThereAreMultiplePartialMatchesAndOnePreciseMatch._.verified/TestAssets.TemplateWithMultipleChoicesAndPartialMatches/Program.cs @@ -0,0 +1,10 @@ +namespace ConsoleApp +{ + internal class Program + { + static void Main(string[] args) + { + Console.WriteLine("User's choice is: aa."); + } + } +} diff --git a/test/Microsoft.TemplateEngine.Orchestrator.RunnableProjects.UnitTests/Microsoft.TemplateEngine.Orchestrator.RunnableProjects.UnitTests.csproj b/test/Microsoft.TemplateEngine.Orchestrator.RunnableProjects.UnitTests/Microsoft.TemplateEngine.Orchestrator.RunnableProjects.UnitTests.csproj index 68aa13cfed3..b18f8172bc7 100644 --- a/test/Microsoft.TemplateEngine.Orchestrator.RunnableProjects.UnitTests/Microsoft.TemplateEngine.Orchestrator.RunnableProjects.UnitTests.csproj +++ b/test/Microsoft.TemplateEngine.Orchestrator.RunnableProjects.UnitTests/Microsoft.TemplateEngine.Orchestrator.RunnableProjects.UnitTests.csproj @@ -1,7 +1,7 @@ - $(NetCurrent);$(NetFrameworkCurrent) + $(NetCurrent);net481 diff --git a/test/Microsoft.TemplateEngine.Orchestrator.RunnableProjects.UnitTests/SnapshotTests.cs b/test/Microsoft.TemplateEngine.Orchestrator.RunnableProjects.UnitTests/SnapshotTests.cs index 8e723be205f..002150d8ab5 100644 --- a/test/Microsoft.TemplateEngine.Orchestrator.RunnableProjects.UnitTests/SnapshotTests.cs +++ b/test/Microsoft.TemplateEngine.Orchestrator.RunnableProjects.UnitTests/SnapshotTests.cs @@ -273,6 +273,35 @@ public Task TestTemplateWithCircleDependencyInMacros() VerificationEngine engine = new VerificationEngine(_log); return engine.Execute(options); } + + [Fact] + public Task TestSelectionForMultiChoicesWhenThereAreMultiplePartialMatchesAndOnePreciseMatch() + { + string templateLocation = GetTestTemplateLocation("TemplateWithMultipleChoicesAndPartialMatches"); + var templateParams = new Dictionary() + { + // There are multiple choices for the parameter that overlap: "aab", "aac", "aa". + // We want to ensure that "aa" can be selected, because it is a precise match, + // even if there are more than one choices that start with "aa", and even if "aa", + // is not listed first in the list of choices. + { "tests", "aa" } + }; + string workingDir = TestUtils.CreateTemporaryFolder(); + + TemplateVerifierOptions options = + new TemplateVerifierOptions(templateName: "TestAssets.TemplateWithMultipleChoicesAndPartialMatches") + { + TemplatePath = templateLocation, + OutputDirectory = workingDir, + DoNotAppendTemplateArgsToScenarioName = true, + DoNotPrependTemplateNameToScenarioName = true, + SnapshotsDirectory = "Approvals" + } + .WithInstantiationThroughTemplateCreatorApi(templateParams); + + VerificationEngine engine = new VerificationEngine(_log); + return engine.Execute(options); + } } } diff --git a/test/Microsoft.TemplateEngine.TestTemplates/test_templates/TemplateWithMultipleChoicesAndPartialMatches/.template.config/template.json b/test/Microsoft.TemplateEngine.TestTemplates/test_templates/TemplateWithMultipleChoicesAndPartialMatches/.template.config/template.json new file mode 100644 index 00000000000..56a3baf4aaf --- /dev/null +++ b/test/Microsoft.TemplateEngine.TestTemplates/test_templates/TemplateWithMultipleChoicesAndPartialMatches/.template.config/template.json @@ -0,0 +1,36 @@ +{ + "$schema": "https://json.schemastore.org/template.json", + "author": "Test Asset", + "classifications": [ "Test Asset" ], + "name": "TemplateWithMultipleChoicesAndPartialMatches", + "tags": { "type": "project" }, + "generatorVersions": "[1.0.0.0-*)", + "groupIdentity": "TestAssets.TemplateWithMultipleChoicesAndPartialMatches", + "precedence": "100", + "identity": "TestAssets.TemplateWithMultipleChoicesAndPartialMatches", + "shortName": "TestAssets.TemplateWithMultipleChoicesAndPartialMatches", + "symbols": { + "tests": { + "displayName": "Tests", + "type": "parameter", + "datatype": "choice", + "replaces": "user_selectedtests", + "allowMultipleValues": true, + "enableQuotelessLiterals": true, + "choices": [ + { + "choice": "aab", + "displayName": "aab" + }, + { + "choice": "aaa", + "displayName": "aaa" + }, + { + "choice": "aa", + "displayName": "aa" + } + ] + } + } +} diff --git a/test/Microsoft.TemplateEngine.TestTemplates/test_templates/TemplateWithMultipleChoicesAndPartialMatches/Program.cs b/test/Microsoft.TemplateEngine.TestTemplates/test_templates/TemplateWithMultipleChoicesAndPartialMatches/Program.cs new file mode 100644 index 00000000000..c6fa1ba813c --- /dev/null +++ b/test/Microsoft.TemplateEngine.TestTemplates/test_templates/TemplateWithMultipleChoicesAndPartialMatches/Program.cs @@ -0,0 +1,10 @@ +namespace ConsoleApp +{ + internal class Program + { + static void Main(string[] args) + { + Console.WriteLine("User's choice is: user_selectedtests."); + } + } +}