-
Notifications
You must be signed in to change notification settings - Fork 693
aspire config set writes appHostPath to ~/.aspire/settings.json globally, causing incorrect path resolution #10700
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
@copilot we are changing the strategy for solving this but. To remove ambiguity we are going to rename the global settings file from |
Co-authored-by: mitchdenny <[email protected]>
Updated the code to rename the global settings file from The change is in commit 67cd7af. |
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 addresses an issue where aspire config set
incorrectly writes the appHostPath
to the global settings file instead of local project settings. The problem occurs when the configuration service searches for existing settings files and mistakenly treats the global ~/.aspire/settings.json
file as a local settings file when the project is located under the user's home directory.
- Changes the global settings file name from
settings.json
toglobalsettings.json
to avoid conflicts - Prevents the configuration service from treating global settings as local settings during path resolution
var homeDirectory = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile); | ||
var globalSettingsPath = ConfigurationHelper.BuildPathToSettingsJsonFile(homeDirectory); | ||
var globalSettingsPath = Path.Combine(homeDirectory, ".aspire", "globalsettings.json"); |
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.
Hardcoding the filename 'globalsettings.json' here creates a discrepancy with the ConfigurationHelper.BuildPathToSettingsJsonFile() method that was previously used. Consider creating a constant or method to ensure consistency across the codebase for the global settings filename.
Copilot uses AI. Check for mistakes.
/backport to release/9.4 |
Started backporting to release/9.4: https://github.com/dotnet/aspire/actions/runs/16572869923 |
Analyzing and fixing the issue where
aspire config set
writesappHostPath
to global settings file instead of local project settings.Analysis
The issue occurs in the
ConfigurationService.FindNearestSettingsFile()
method. Whenaspire run
tries to create local settings with theappHostPath
, the method walks up the directory tree looking for existing settings files. If the user's project is under their home directory, this search can find the global~/.aspire/settings.json
file and treat it as a "local" settings file, causing theappHostPath
to be written globally instead of locally.Plan
ConfigurationService.FindNearestSettingsFile()
Fixes #10699.
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.