Skip to content

Conversation

mitchdenny
Copy link
Member

@mitchdenny mitchdenny commented Apr 21, 2025

This PR improves usability of the aspire [run|add|publish] commands by searching for valid app hosts in sub-directories, using the current working directory as a starting point. Here is a walkthrough video showing it in action. The important thing to note here is that we did not change into the src/HelloAspire.AppHost` sub directory in order for this command to work.

aspire-recursive-search.mp4

Note that this recursive search behavior can be expensive in projects with a large number of *.csproj files so it is possible to place a .aspire/settings.json file in the current directory or any parent directory to short-circuit the discovery process and point directly to a well known apphost.

Included in this PR is a mechanism whereby this configuration file is automatically dropped in the <workingdir>/.aspire/settings.json path to avoid subsequent invocations taking as long. The idea is that by the time it becomes a problem in a repository the settings file is present.

@mitchdenny mitchdenny requested a review from davidfowl April 21, 2025 06:16
@mitchdenny mitchdenny self-assigned this Apr 21, 2025
@mitchdenny mitchdenny added this to the 9.3 milestone Apr 21, 2025
@mitchdenny mitchdenny marked this pull request as ready for review April 21, 2025 09:06
@davidfowl
Copy link
Member

Is there a fast path for csproj in the current directory or do I pay for this everytime?

@mitchdenny
Copy link
Member Author

If you invoke aspire run in the app host directory we will drop a .aspire/settings.json file so that subsequent executions don't traverse. In effect if you are in the apphost folder you'll only see one csproj file anyway, so it'll be almost the same as the current behavior.

@mitchdenny mitchdenny merged commit 6a3c091 into main Apr 22, 2025
174 checks passed
@mitchdenny mitchdenny deleted the mitchdenny/aspire-apphost-search branch April 22, 2025 05:37
@github-actions github-actions bot locked and limited conversation to collaborators May 22, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants