Skip to content

Fix template version parsing for .NET 10.0 SDK separator change#14285

Merged
davidfowl merged 3 commits intomainfrom
copilot/fix-failed-template-parsing-error
Feb 3, 2026
Merged

Fix template version parsing for .NET 10.0 SDK separator change#14285
davidfowl merged 3 commits intomainfrom
copilot/fix-failed-template-parsing-error

Conversation

Copy link
Contributor

Copilot AI commented Feb 2, 2026

Description

.NET 10.0 SDK changed template version separator from :: to @ in dotnet new install output. The CLI command construction was already updated but the parsing logic wasn't, causing aspire new to fail with "Failed to parse template version from stdout."

Example failure:

Success: Aspire.ProjectTemplates@13.2.0-preview.1.26101.12 installed...
[fail] Failed to parse template version from stdout.

Changes:

  • Updated TryParsePackageVersionFromStdout to parse @ separator with :: fallback for backward compatibility
  • Made method internal (was private) to enable unit testing
  • Added parameterized unit test using Theory and InlineData covering new format, old format, and error cases

Checklist

  • Is this feature complete?
    • Yes. Ready to ship.
    • No. Follow-up changes expected.
  • Are you including unit tests for the changes and scenario tests if relevant?
    • Yes
    • No
  • Did you add public API?
    • Yes
      • If yes, did you have an API Review for it?
        • Yes
        • No
      • Did you add <remarks /> and <code /> elements on your triple slash comments?
        • Yes
        • No
    • No
  • Does the change make any security assumptions or guarantees?
    • Yes
      • If yes, have you done a threat model and had a security review?
        • Yes
        • No
    • No
  • Does the change require an update in our Aspire docs?
Original prompt

This section details on the original issue you should resolve

<issue_title>aspire new error: Failed to parse template version from stdout.</issue_title>
<issue_description>### Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

Enter the project name (Temp): Tlds
Enter the output path: (./Tlds): ./Tlds
Searching for available project template versions...
✔  Using *.dev.localhost URLs for local development.
🧊  Getting templates...
[17:16:50] [dbug] DotNetCliRunner: Running dotnet with args: new install Aspire.ProjectTemplates@13.2.0-preview.1.26101.12 --force --nuget-source https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet9/nuget/v3/index.json
[17:16:50] [dbug] DotNetCliRunner: Running dotnet with env: DOTNET_CLI_UI_LANGUAGE=en-US
[17:16:50] [dbug] DotNetCliRunner: Started dotnet with PID: 67288
[17:16:50] [dbug] DotNetCliRunner: Waiting for dotnet process to exit with PID: 67288
[17:16:50] [dbug] DotNetCliRunner: Starting to forward stream with identifier 'stderr' on process '67288' to logger
[17:16:50] [dbug] DotNetCliRunner: Starting to forward stream with identifier 'stdout' on process '67288' to logger
[17:16:50] [dbug] DotNetCliRunner: dotnet(67288) stdout: The following template packages will be installed:
[17:16:50] [dbug] DotNetCliRunner: dotnet(67288) stdout:    Aspire.ProjectTemplates@13.2.0-preview.1.26101.12
[17:16:50] [dbug] DotNetCliRunner: dotnet(67288) stdout:
[17:16:51] [dbug] DotNetCliRunner: dotnet(67288) stdout: Aspire.ProjectTemplates (version 13.2.0-preview.1.26101.12) is already installed, it will be replaced with version 13.2.0-preview.1.26101.12.
[17:16:51] [dbug] DotNetCliRunner: dotnet(67288) stdout: Aspire.ProjectTemplates@13.2.0-preview.1.26101.12 was successfully uninstalled.
[17:16:54] [dbug] DotNetCliRunner: dotnet(67288) stdout: Success: Aspire.ProjectTemplates@13.2.0-preview.1.26101.12 installed the following templates:
[17:16:54] [dbug] DotNetCliRunner: dotnet(67288) stdout: Template Name                             Short Name                 Language  Tags
[17:16:54] [dbug] DotNetCliRunner: dotnet(67288) stdout: ----------------------------------------  -------------------------  --------  --------------------------------------------------------------------------
[17:16:54] [dbug] DotNetCliRunner: dotnet(67288) stdout: Aspire AppHost                            aspire-apphost             [C#]      Common/Aspire/Cloud
[17:16:54] [dbug] DotNetCliRunner: dotnet(67288) stdout: Aspire Empty App                          aspire                     [C#]      Common/Aspire/Cloud/Web/Web API/API/Service
[17:16:54] [dbug] DotNetCliRunner: dotnet(67288) stdout: Aspire Service Defaults                   aspire-servicedefaults     [C#]      Common/Aspire/Cloud/Web/Web API/API/Service
[17:16:54] [dbug] DotNetCliRunner: dotnet(67288) stdout: Aspire Single-File App Host               aspire-apphost-singlefile  [C#]      Common/Aspire/AppHost/SingleFile
[17:16:54] [dbug] DotNetCliRunner: dotnet(67288) stdout: Aspire Starter App (ASP.NET Core/Blazor)  aspire-starter             [C#]      Common/Aspire/Cloud/Web/Web API/API/Service/Blazor/Test/MSTest/NUnit/xUnit
[17:16:54] [dbug] DotNetCliRunner: dotnet(67288) stdout: Aspire Starter App (ASP.NET Core/React)   aspire-ts-cs-starter       [C#]      Common/Aspire/Cloud/Web/Web API/API/Service/TypeScript/React
[17:16:54] [dbug] DotNetCliRunner: dotnet(67288) stdout: Aspire Starter App (FastAPI/React)        aspire-py-starter          Python    Common/Aspire/Cloud/Web/Web API/API/Service/Python/TypeScript/React
[17:16:54] [dbug] DotNetCliRunner: dotnet(67288) stdout: Aspire Test Project (MSTest)              aspire-mstest              [C#]      Common/Aspire/Cloud/Web/Web API/API/Service/Test/MSTest
[17:16:54] [dbug] DotNetCliRunner: dotnet(67288) stdout: Aspire Test Project (NUnit)               aspire-nunit               [C#]      Common/Aspire/Cloud/Web/Web API/API/Service/Test/NUnit
[17:16:54] [dbug] DotNetCliRunner: dotnet(67288) stdout: Aspire Test Project (xUnit)               aspire-xunit               [C#]      Common/Aspire/Cloud/Web/Web API/API/Service/Test/xUnit
[17:16:54] [dbug] DotNetCliRunner: dotnet(67288) stdout:
[17:16:54] [dbug] DotNetCliRunner: dotnet process with PID: 67288 has exited with code: 0
[17:16:54] [dbug] DotNetCliRunner: Closing stdout/stderr streams for PID: 67288
[17:16:54] [dbug] DotNetCliRunner: Pending forwarders for PID completed: 67288
[17:16:54] [fail] DotNetCliRunner: Failed to parse template version from stdout.
[17:16:54] [fail] Program: An unexpected error occurred. System.InvalidOperationException: Failed to parse template version from stdout.
   at Aspire.Cli.DotNet.DotNetCliRunner.<InstallTemplateAsync>d__25.MoveNext() + 0x5c0
--- End of stack trace from previous location ---
   at Aspire.Cli.Templating.DotNetTemplateFactory.<>c__DisplayClass32_0.<<ApplyTemplateAsync>b__0>d.MoveNext() + 0x5e
--- End of stack trace from previou...

</details>



<!-- START COPILOT CODING AGENT SUFFIX -->

- Fixes dotnet/aspire#14284

<!-- START COPILOT CODING AGENT TIPS -->
---

✨ Let Copilot coding agent [set things up for you](https://github.com/dotnet/aspire/issues/new?title=✨+Set+up+Copilot+instructions&body=Configure%20instructions%20for%20this%20repository%20as%20documented%20in%20%5BBest%20practices%20for%20Copilot%20coding%20agent%20in%20your%20repository%5D%28https://gh.io/copilot-coding-agent-tips%29%2E%0A%0A%3COnboard%20this%20repo%3E&assignees=copilot) — coding agent works faster and does higher quality work when set up for your repo.

Co-authored-by: JamesNK <303201+JamesNK@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix error parsing template version from stdout Fix template version parsing for .NET 10.0 SDK separator change Feb 2, 2026
Copilot AI requested a review from JamesNK February 2, 2026 09:28
@JamesNK
Copy link
Member

JamesNK commented Feb 2, 2026

@copilot Refactor into one parameterized unit test

@JamesNK JamesNK marked this pull request as ready for review February 2, 2026 09:32
Copilot AI review requested due to automatic review settings February 2, 2026 09:32
@github-actions
Copy link
Contributor

github-actions bot commented Feb 2, 2026

🚀 Dogfood this PR with:

⚠️ WARNING: Do not do this without first carefully reviewing the code of this PR to satisfy yourself it is safe.

curl -fsSL https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 14285

Or

  • Run remotely in PowerShell:
iex "& { $(irm https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 14285"

@JamesNK
Copy link
Member

JamesNK commented Feb 2, 2026

@mitchdenny @davidfowl @DamianEdwards I've never touched this area before.

Why did I get a @ separator instead of ::? It feels strange that no one else has run into this before.
Is it a new change in .NET SDK?
Is this fix correct/desirable?

Co-authored-by: JamesNK <303201+JamesNK@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Feb 2, 2026

@copilot Refactor into one parameterized unit test

Refactored into a single parameterized test using Theory and InlineData. All 4 test cases still pass. (9600506)

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • centralus-2.in.applicationinsights.azure.com
    • Triggering command: /home/REDACTED/work/aspire/aspire/artifacts/bin/Aspire.Cli.Tests/Debug/net10.0/Aspire.Cli.Tests /home/REDACTED/work/aspire/aspire/artifacts/bin/Aspire.Cli.Tests/Debug/net10.0/Aspire.Cli.Tests --internal-msbuild-node /home/REDACTED/.local/share/6afe8ab9976941c29c0e0ad3e7cd60b4/.p --filter-not-trait category=failing --filter-not-trait quarantined=true --filter-not-trait outerloop=true (dns block)
    • Triggering command: /usr/share/dotnet/dotnet /usr/share/dotnet/dotnet exec --runtimeconfig /home/REDACTED/work/aspire/aspire/artifacts/bin/Aspire.Cli.Tests/Debug/net10.0/Aspire.Cli.Tests.runtimeconfig.json --depsfile /home/REDACTED/work/aspire/aspire/artifacts/bin/Aspire.Cli.Tests/Debug/net10.0/Aspire.Cli.Tests.deps.json /home/REDACTED/work/aspire/aspire/artifacts/bin/Aspire.Cli.Tests/Debug/net10.0/Microsoft.DotNet.RemoteExecutor.dll Aspire.Cli.Tests, Version=42.42.42.42, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51 Aspire.Cli.Tests.CliSmokeTests&#43;&lt;&gt;c &lt;LocaleOverrideReturnsExitCode&gt;b__4_0 /tmp/0n1u0pxg.3n5 invalid-locale False ASPIRE_LOCALE_OVERRIDE (dns block)
    • Triggering command: /usr/share/dotnet/dotnet /usr/share/dotnet/dotnet exec --runtimeconfig /home/REDACTED/work/aspire/aspire/artifacts/bin/Aspire.Cli.Tests/Debug/net10.0/Aspire.Cli.Tests.runtimeconfig.json --depsfile /home/REDACTED/work/aspire/aspire/artifacts/bin/Aspire.Cli.Tests/Debug/net10.0/Aspire.Cli.Tests.deps.json /home/REDACTED/work/aspire/aspire/artifacts/bin/Aspire.Cli.Tests/Debug/net10.0/Microsoft.DotNet.RemoteExecutor.dll Aspire.Cli.Tests, Version=42.42.42.42, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51 Aspire.Cli.Tests.CliSmokeTests&#43;&lt;&gt;c &lt;LocaleOverrideReturnsExitCode&gt;b__4_0 /tmp/0n1u0pxg.3n5 (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a parsing failure in the Aspire CLI when using .NET 10.0 SDK, which changed the template version separator from :: to @ in dotnet new install output.

Changes:

  • Updated TryParsePackageVersionFromStdout to parse both @ (new format) and :: (old format) separators with fallback for backward compatibility
  • Changed method visibility from private to internal to enable unit testing
  • Added 4 comprehensive unit tests covering new format, old format, missing success line, and invalid format scenarios

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/Aspire.Cli/DotNet/DotNetCliRunner.cs Updated parsing logic to handle both @ and :: separators with fallback; changed method visibility to internal
tests/Aspire.Cli.Tests/DotNet/DotNetCliRunnerTests.cs Added 4 unit tests covering new format, legacy format, and error cases

@DamianEdwards
Copy link
Member

@JamesNK what .NET 10 SDK version do you have installed? I'm wondering if you picked up a 10.0.200 preview from VS insiders/dogfood and the change came with that.

@JamesNK
Copy link
Member

JamesNK commented Feb 2, 2026

C:\Development\Source> dotnet --info
.NET SDK:
Version: 10.0.200-preview.0.26079.118
Commit: 1359b581c6
Workload version: 10.0.200-manifests.e19a1c0a
MSBuild version: 18.3.0-release-26079-118+1359b581c

@JamesNK
Copy link
Member

JamesNK commented Feb 2, 2026

10.0.102:

C:\Development\Source\aspire [jamesnk/remove-test-delay ≡]> dotnet new install Aspire.ProjectTemplates
The following template packages will be installed:
Aspire.ProjectTemplates

Aspire.ProjectTemplates (version 13.1.0) is already installed, it will be replaced with latest version.
Aspire.ProjectTemplates::13.1.0 was successfully uninstalled.
Success: Aspire.ProjectTemplates::13.1.0 installed the following templates:

10.0.200-preview.0.26079.118:

C:\Development\Source> dotnet new install Aspire.ProjectTemplates
The following template packages will be installed:
Aspire.ProjectTemplates

Aspire.ProjectTemplates (version 13.1.0) is already installed, it will be replaced with latest version.
Aspire.ProjectTemplates@13.1.0 was successfully uninstalled.
Success: Aspire.ProjectTemplates@13.1.0 installed the following templates:

Confirmed that it's a change in new SDK.

@DamianEdwards
Copy link
Member

@JamesNK cool that confirms it then. Do your changes support both formats?

@JamesNK
Copy link
Member

JamesNK commented Feb 3, 2026

Yes

    [Theory]
    [InlineData("Success: Aspire.ProjectTemplates@13.2.0-preview.1.26101.12 installed the following templates:", true, "13.2.0-preview.1.26101.12")] // New .NET 10.0 SDK format with @ separator
    [InlineData("Success: Aspire.ProjectTemplates::13.2.0-preview.1.26101.12 installed the following templates:", true, "13.2.0-preview.1.26101.12")] // Old SDK format with :: separator
    [InlineData("Some other output", false, null)] // Missing success line
    [InlineData("Success: Aspire.ProjectTemplates installed the following templates:", false, null)] // Invalid format without version separator
    public void TryParsePackageVersionFromStdout_ParsesCorrectly(string stdout, bool expectedResult, string? expectedVersion)

@davidfowl davidfowl merged commit 0b4d429 into main Feb 3, 2026
335 checks passed
@davidfowl davidfowl deleted the copilot/fix-failed-template-parsing-error branch February 3, 2026 01:21
@dotnet-policy-service dotnet-policy-service bot added this to the 13.2 milestone Feb 3, 2026
JamesNK added a commit that referenced this pull request Feb 25, 2026
* Initial plan

* Fix template version parsing to support @ separator for .NET 10.0 SDK

Co-authored-by: JamesNK <303201+JamesNK@users.noreply.github.com>

* Refactor into parameterized test using Theory and InlineData

Co-authored-by: JamesNK <303201+JamesNK@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: JamesNK <303201+JamesNK@users.noreply.github.com>
joperezr added a commit that referenced this pull request Feb 26, 2026
…or change (#14698)

* Fix template version parsing for .NET 10.0 SDK separator change (#14285)

* Initial plan

* Fix template version parsing to support @ separator for .NET 10.0 SDK

Co-authored-by: JamesNK <303201+JamesNK@users.noreply.github.com>

* Refactor into parameterized test using Theory and InlineData

Co-authored-by: JamesNK <303201+JamesNK@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: JamesNK <303201+JamesNK@users.noreply.github.com>

* Fix

* Update pinned SDK version to 10.0.102 (#13936)

* Initial plan

* Update SDK version from 10.0.101 to 10.0.102

Co-authored-by: danegsta <50252651+danegsta@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: danegsta <50252651+danegsta@users.noreply.github.com>

* Apply suggestions from code review

* Make Ubuntu runner not identify as WSL2 (#14440)

* Try making dotnet not identify github as WSL2, ignore trust error

* Skip on error

* Remove continue-on-error since workaround was successful

* Allow exit code 4

* Add comment explaining workaround

---------

Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com>
Co-authored-by: JamesNK <303201+JamesNK@users.noreply.github.com>
Co-authored-by: danegsta <50252651+danegsta@users.noreply.github.com>
Co-authored-by: Jose Perez Rodriguez <joperezr@microsoft.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants