Skip to content
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

Aspire disregards specified launch-settings commands #4907

Open
g-martin772 opened this issue Jul 15, 2024 · 10 comments
Open

Aspire disregards specified launch-settings commands #4907

g-martin772 opened this issue Jul 15, 2024 · 10 comments
Labels
area-app-model Issues pertaining to the APIs in Aspire.Hosting, e.g. DistributedApplication untriaged New issue has not been triaged

Comments

@g-martin772
Copy link

When running a Project with Aspire locally there is the option to specify a launch profile in the builder.AddProject(string, string), which is being ten being read. After reviewing the code a bit, it appears that only the "applicationUrl" and "commandLineArgs" fields are being evaluated. Personally, I am mostly interested in the "executablePath" field. For example, referencing the dotnet executable to run the project using .NET "dotnet watch" when running locally to enable nice hot reloading (outside of VS, and yes, I am aware of the open SDK issue regarding watch support for aspire).

"Watch": {
      "commandName": "Executable",
      "executablePath": "dotnet",
      "workingDirectory": "$(ProjectDir)",
      "hotReloadEnabled": true,
      "hotReloadProfile": "aspnetcore",
      "commandLineArgs": "watch run",
      "launchBrowser": false,
      "applicationUrl": "http://localhost:4110",
      "environmentVariables": {
        "ASPNETCORE_ENVIRONMENT": "Development"
      }
    },

This is what I used to do with basically all of my projects and it used to work pretty great so far, and I don't know if I am going insane at that point but I feel like this also used to work when running in Aspire....

It would be cool if the "commandName" and "executablePath" (and maybe some of the other more relevant fields as well) would be interpreted correctly. I think this should only require changes to the builder and how the executable path is being set in the end. I actually tried implementing this myself but it didn't work as expected.

Would this be possible or is running the application directly a strict requirement here?

@dotnet-issue-labeler dotnet-issue-labeler bot added the area-app-model Issues pertaining to the APIs in Aspire.Hosting, e.g. DistributedApplication label Jul 15, 2024
@g-martin772
Copy link
Author

Could I please get any feedback on this?

@davidfowl
Copy link
Member

I think this would break debugging. Maybe that's ok in this situation?

@g-martin772
Copy link
Author

Ahh, yes, thats probably true. But for everyone working outside of visual studio having atleast some sort of hot reloading whould really be great. I know some of thoose things are still being worked on. Whould this be a viable option to consider? Otherwise you can just close the issue.

@davidfowl
Copy link
Member

You can use dotnet watch on the apphost project today without changing the launch profile.

@g-martin772
Copy link
Author

Yes, but doesn’t that only apply to the apphost itself? I am talking about making this work for "sub project" aswell that are started using the apphost because you have no control on how it does that internally.

@davidfowl
Copy link
Member

No it doesn’t. It’s handled specially

@g-martin772
Copy link
Author

g-martin772 commented Sep 8, 2024

I am on the latest version of .NET 8 and Aspire workloads and then I run the apphost project from the terminal using dotnet watch I only get

 dotnet watch
dotnet watch 🔥 Hot reload enabled. For a list of supported edits, see https://aka.ms/dotnet/hot-reload.                 
  💡 Press "Ctrl + R" to restart.                                                                                        
dotnet watch ⌚ Started                                                                                                   
Building...                                                                                                              
C:\dev\work\AspireApp1\AspireApp1.AppHost\AspireApp1.AppHost.csproj : warning NU1903: Package 'System.Text.Json' 8.0.0 has a known high severity vulnerability, https://github.com/advisories/GHSA-hh2w-p6rv-4g7w
C:\dev\work\AspireApp1\AspireApp1.AppHost\AspireApp1.AppHost.csproj : warning NU1903: Package 'System.Text.Json' 8.0.0 has a known high severity vulnerability, https://github.com/advisories/GHSA-hh2w-p6rv-4g7w
info: Aspire.Hosting.DistributedApplication[0]
      Aspire version: 8.2.0+75fdcff28495bdd643f6323133a7d411df71ab70
info: Aspire.Hosting.DistributedApplication[0]
      Distributed application starting.
info: Aspire.Hosting.DistributedApplication[0]
      Application host directory is: C:\dev\work\AspireApp1\AspireApp1.AppHost
info: Aspire.Hosting.DistributedApplication[0]
      Now listening on: https://localhost:15222

instead of what I get when launching it via IDE:

image

Also using the default Aspire App template, even with dotnet watch, it does not recognize file changes to for example the razor home page in the Web Project. I also found this issue which still seems to be not resolved. Am I doing something wrong here?

@davidfowl
Copy link
Member

Does it detect changes to .cs files?

@g-martin772
Copy link
Author

Only in the apphost project, it doesn't pick up any other changes.

@davidfowl davidfowl added the bug label Sep 15, 2024
@davidfowl
Copy link
Member

We're updating dotnet watch to better handle aspire scenarios (it'll make things like razor files work and it'll be more incremental for aspire), hopefully it will fix these problems.

Follow this issue dotnet/sdk#36971

@joperezr joperezr added the untriaged New issue has not been triaged label Oct 15, 2024
@davidfowl davidfowl removed the bug label Oct 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-app-model Issues pertaining to the APIs in Aspire.Hosting, e.g. DistributedApplication untriaged New issue has not been triaged
Projects
None yet
Development

No branches or pull requests

3 participants