-
Notifications
You must be signed in to change notification settings - Fork 692
Implement feature flag validation and cleanup for single file AppHost support in RunCommand #11397
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If anyone wants to following along at home, here is an apphost.cs file that will work with this change:
#:sdk Microsoft.NET.Sdk
#:sdk Aspire.AppHost.Sdk@9.5.0-preview.1.25460.2
#:package Aspire.Hosting.AppHost@9.5.0-preview.1.25460.2
#:property PublishAot=false
var builder = DistributedApplication.CreateBuilder(args);
builder.Build().Run();
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 11397 Or
iex "& { $(irm https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 11397" |
1 similar comment
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 11397 Or
iex "& { $(irm https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 11397" |
@mitchdenny why do we need both sdks? |
Yeah without it it doesn't understand PackageReference at this point. |
c992623
to
4c9b359
Compare
… support Co-authored-by: mitchdenny <[email protected]>
1277387
to
34ad423
Compare
There was a problem hiding this 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 completes the single file AppHost implementation in the RunCommand by adding proper feature flag validation and cleaning up redundant logic. The changes ensure that when a .cs
file is detected as an AppHost, the feature flag is properly validated before proceeding with execution.
Key changes:
- Added feature flag validation with clear error messaging when single file AppHost is disabled
- Cleaned up redundant build logic checks and streamlined control flow
- Added comprehensive localization support for the new error message
Reviewed Changes
Copilot reviewed 18 out of 19 changed files in this pull request and generated 3 comments.
Show a summary per file
File | Description |
---|---|
src/Aspire.Cli/Commands/RunCommand.cs |
Main implementation adding feature flag validation and logic cleanup for single file AppHost support |
src/Aspire.Cli/DotNet/DotNetCliRunner.cs |
Updated CLI argument construction to handle single file AppHost execution |
src/Aspire.Cli/Resources/ErrorStrings.resx |
Added new error string for single file AppHost feature validation |
src/Aspire.Cli/Resources/xlf/*.xlf |
Added localized translations for the new error message across multiple languages |
tests/Aspire.Cli.Tests/Commands/RunCommandTests.cs |
Added test coverage for feature flag validation error scenario |
src/Aspire.Cli/Utils/AppHostHelper.cs |
Minor whitespace cleanup |
Files not reviewed (1)
- src/Aspire.Cli/Resources/ErrorStrings.Designer.cs: Language not supported
This PR completes the single file AppHost implementation in the
RunCommand
by adding proper feature flag validation and cleaning up redundant logic.Changes Made
Feature Flag Validation
singlefileAppHostEnabled
feature flag is enabled when a.cs
file is detected as an AppHostProjectLocator
which already checks this feature flagCode Cleanup
!isSingleFileAppHost
check in the build logic (was checked at lines 130 and 142)Error Handling
SingleFileAppHostFeatureNotEnabled
error string to resources with proper localization support.resx
and.Designer.cs
files following the project's resource management patternsTest Coverage
RunCommand_WhenSingleFileAppHostAndFeatureDisabled_ReturnsNonZeroExitCode
to verify proper error handlingBehavior
Before: The
RunCommand
would attempt to process.cs
files returned byProjectLocator
without validating if the feature was enabled, potentially leading to inconsistent behavior.After: The
RunCommand
now properly validates the feature flag and provides clear feedback:Configuration
The feature can be enabled via:
features__singlefileAppHostEnabled=true
.aspire/settings.json
:This change ensures the RunCommand implementation is fully consistent with the ProjectLocator's feature flag handling while maintaining backward compatibility and providing clear user feedback.
Created from VS Code via the GitHub Pull Request extension.
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.