Skip to content

Restore Visual Studio Aspire version discovery in empty template - #21506

Draft
Jose Perez Rodriguez (joperezr) wants to merge 1 commit into
mainfrom
joperezr-cti-validation-investigation
Draft

Jose Perez Rodriguez (joperezr) wants to merge 1 commit into
mainfrom
joperezr-cti-validation-investigation

Conversation

@joperezr

Copy link
Copy Markdown
Member

Description

Sketch a template-only fix for the missing Enlist in Aspire orchestration checkbox in Visual Studio's new-project dialog with Aspire 17 preview templates.

The empty-app template's AspireVersion symbol changed from a choice to a string in #21263. Visual Studio discovers installed Aspire versions from that symbol's choices, so removing them prevents version discovery and hides the orchestration checkbox.

Restore the major/minor choice metadata and disable the unused AspireVersion parameter for the Aspire CLI host. Package references in the generated empty app are already stamped with the full package version during template packaging.

The proposed condition uses a hidden HostIdentifier parameter, populated by the template host's existing default of the same name. The existing lowercase hostIdentifier bind symbol is retained for content and post-action conditions. This distinction is intentional: the CLI's early parameter-condition evaluator does not populate bind symbols before deciding whether to inject its full SDK version. Hide the new internal parameter in the Aspire CLI, dotnet CLI, and IDE host configuration.

No Visual Studio, CLI implementation, or template-engine changes are proposed.

cc Phil Henning (@phenning) Damian Edwards (@DamianEdwards)

User-facing usage

The intended behavior is to restore the existing Visual Studio workflow:

New Project > ASP.NET Core Web App (Razor Pages) > .NET 10
Additional information > Enlist in Aspire orchestration

The version parameter returns to a numeric major/minor choice, with a host-specific enablement condition:

{
  "datatype": "choice",
  "choices": [
    {
      "choice": "17.0"
    }
  ],
  "defaultValue": "17.0",
  "isEnabled": "(HostIdentifier != \"aspirecli\")"
}

The source continues to use the existing packaging placeholders rather than hardcoding 17.0.

Validation

This is an unvalidated draft proposal. Do not merge until the PR build has been installed and the reported scenario has been verified with Elena's help.

No build, automated tests, template instantiation, or Visual Studio end-to-end validation has been run. JSON parsing and git diff --check passed; these are syntax/whitespace checks only and do not establish that the fix works.

Before checking this in:

  • Coordinate with Elena to install the PR build, including the matching Aspire.ProjectTemplates package used by Visual Studio. Installing only the PR CLI would not exercise the changed template metadata.
  • Restart Visual Studio and verify that the orchestration checkbox appears for Razor Pages, MVC, and Blazor on supported target frameworks, starting with .NET 10.
  • Select the checkbox, create the application, and verify that orchestration is configured and the AppHost retains the full PR/preview package versions.
  • Verify interactive and non-interactive Aspire CLI template-engine creation from the PR-built empty template. Confirm that the host condition disables AspireVersion without rejecting the injected full version or changing generated package references.
  • Add focused regression coverage for choice-based version discovery and host-specific parameter enablement.

Fixes # (issue)

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

Restore the AspireVersion choice contract and conditionally disable the unused parameter for the Aspire CLI host.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@github-actions

Copy link
Copy Markdown
Contributor

🚀 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/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 21506

Or

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

@github-actions

Copy link
Copy Markdown
Contributor

Tests selector

3 / 100 PR test projects · 2 PR jobs, from 4 changed files.

Selected PR test projects (3 / 100)

Aspire.Cli.EndToEnd.Tests, Aspire.Cli.Tests, Aspire.Templates.Tests

Selected PR jobs (2)

homebrew-installer, winget-installer


How these were chosen — grouped by what changed

🔧 src/Aspire.ProjectTemplates/templates/aspire-empty/.template.config/aspirecli.host.json (changed source)
→ 3 directly: Aspire.Cli.EndToEnd.Tests, Aspire.Cli.Tests, Aspire.Templates.Tests

🔧 src/Aspire.ProjectTemplates/templates/aspire-empty/.template.config/dotnetcli.host.json (changed source)
→ 3 directly: Aspire.Cli.EndToEnd.Tests, Aspire.Cli.Tests, Aspire.Templates.Tests

🔧 src/Aspire.ProjectTemplates/templates/aspire-empty/.template.config/ide.host.json (changed source)
→ 3 directly: Aspire.Cli.EndToEnd.Tests, Aspire.Cli.Tests, Aspire.Templates.Tests

🔧 src/Aspire.ProjectTemplates/templates/aspire-empty/.template.config/template.json (changed source)
→ 3 directly: Aspire.Cli.EndToEnd.Tests, Aspire.Cli.Tests, Aspire.Templates.Tests

Job reasons

Job Triggered by
homebrew-installer src/Aspire.ProjectTemplates/templates/aspire-empty/.template.config/aspirecli.host.json, src/Aspire.ProjectTemplates/templates/aspire-empty/.template.config/dotnetcli.host.json, src/Aspire.ProjectTemplates/templates/aspire-empty/.template.config/ide.host.json, src/Aspire.ProjectTemplates/templates/aspire-empty/.template.config/template.json
winget-installer src/Aspire.ProjectTemplates/templates/aspire-empty/.template.config/aspirecli.host.json, src/Aspire.ProjectTemplates/templates/aspire-empty/.template.config/dotnetcli.host.json, src/Aspire.ProjectTemplates/templates/aspire-empty/.template.config/ide.host.json, src/Aspire.ProjectTemplates/templates/aspire-empty/.template.config/template.json

Selection computed for commit 450b05a.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

Non-interactive creation still injects a full SDK preview version into a major/minor-only choice, leaving CLI parameter collection unsafe and requiring an enablement fix plus regression coverage.

1 open issue
What changed in this PR

This template-only proposal restores the version metadata Visual Studio uses to show Enlist in Aspire orchestration, while attempting to keep the unused version parameter disabled for Aspire CLI generation. End-to-end behavior remains unvalidated.

Changes:

  • Restore major/minor AspireVersion choices using existing packaging placeholders.
  • Add a host-defaulted HostIdentifier parameter to control version-parameter enablement.
  • Hide the internal parameter in Aspire CLI, dotnet CLI, and IDE hosts.
File Description
src/​Aspire.ProjectTemplates/​templates/​aspire-empty/​.template.config/​template.json Restores version choices and adds host-specific enablement.
src/​Aspire.ProjectTemplates/​templates/​aspire-empty/​.template.config/​ide.host.json Hides HostIdentifier in IDE hosts.
src/​Aspire.ProjectTemplates/​templates/​aspire-empty/​.template.config/​dotnetcli.host.json Hides HostIdentifier in dotnet CLI.
src/​Aspire.ProjectTemplates/​templates/​aspire-empty/​.template.config/​aspirecli.host.json Hides HostIdentifier in Aspire CLI.

Review effort: Balanced

}
],
"defaultValue": "!!REPLACE_WITH_LATEST_MAJOR_MINOR_VERSION!!",
"isEnabled": "(HostIdentifier != \"aspirecli\")"
@github-actions

Copy link
Copy Markdown
Contributor

Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt.

@github-actions

Copy link
Copy Markdown
Contributor

Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt.

@github-actions

Copy link
Copy Markdown
Contributor

Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants