-
Notifications
You must be signed in to change notification settings - Fork 850
Description
Description
When aspire new creates a project in a subdirectory (e.g., ./MyProject/), two aspire.config.json files end up on disk:
- Root config (
./aspire.config.json): Created byProjectLocator.CreateSettingsFileAsync— hasappHost.pathbut nopackagessection - Project config (
./MyProject/aspire.config.json): Created by the template — has thepackagessection with integration references
When subsequently running aspire run (or during the BuildAndGenerateSdkAsync step of aspire new itself), ConfigurationService.FindNearestSettingsFile walks up from the CWD and finds the root config first. Since the root config has no packages, the NuGet restore only gets Aspire.Hosting core — no integration assemblies are loaded, and the generated TypeScript SDK is missing all integration-specific functions (e.g., addUvicornApp, addViteApp).
Steps to Reproduce
mkdir workspace && cd workspaceaspire new→ select "Starter App (FastAPI/React)" → name itMyAppaspire run(fromworkspace/, NOT fromworkspace/MyApp/)- Observe:
builder.addUvicornApp is not a function
Expected Behavior
Running aspire run from the workspace root should resolve packages from the project-level aspire.config.json (which contains the packages section), not the root config.
Workaround
cd MyApp before running aspire run / aspire start. This makes the config resolution find the correct project-level config.
Root Cause
ProjectLocator.CreateSettingsFileAsyncwritesappHost.pathto a root-levelaspire.config.jsonviaConfigurationService.SetConfigurationAsync("appHost.path", ...)but does not copy thepackagessection from the project config.GuestAppHostProject.GetConfigDirectoryuses_configurationService.GetSettingsFilePath(isGlobal: false)which callsFindNearestSettingsFile— this searches from CWD upward, finding the root config before the project config.- The root config is authoritative for package resolution, but it has no packages.
Affected Scenarios
- Any TypeScript AppHost template with integration packages (
py-starter,ts-starter, etc.) whenaspire runis invoked from a parent directory - The
ts-starterE2E test works around this bycd-ing into the project directory before running
Possible Fixes
ProjectLocator.CreateSettingsFileAsyncshould copy/merge thepackagessection from the project config into the root config- Or
GuestAppHostProjectshould resolve packages from the config nearest to the apphost file, not from CWD - Or
aspire runshould prefer the project-level config when the root config has no packages but points to a subdirectory that does