aspire: Running a .NET project using `AddProject` with the csproj path fails if the project has not been previously built

I’m really glad that Preview 2 of Aspire added the AddProject overload so we can reference a .NET project by providing an arbitrary project path. However, I feel like Aspire currently assumes that this project is part of (and referenced by) the app host solution, which would result in the project being built before being orchestrated by Aspire. If my project is not part of the app host solution and it has not been compiled yet, Aspire will fail to run it as it uses --no-build when preparing the projects.

In my opinion, this process somewhat defeats the purpose of using AddProject with a custom path because if my project is already part of my solution, I would simply use AddProject<> with the generated service metadata.

Is there any plan to consider building the .NET project prior to running it when using AddProject with a custom path? I believe this overload would be beneficial for scenarios where developers deal with multiple solutions in a monorepo (or even multiple repos).

About this issue

  • Original URL
  • State: open
  • Created 3 years ago
  • Reactions: 5
  • Comments: 15 (8 by maintainers)

Most upvoted comments

Moving this to 9 for investigation.

This issue hasn’t been fixed and won’t be for the GA of Aspire. We’ve done some of the foundational work to make this possible but there are still some features that we need to build to make this possible.

This won’t be addressed for Aspire 9, moving to backlog. It’s likely we will work on a bigger work item that will include this work for multi repo support.

As this is moved back to the backlog - Is there a workaround to this? Based on comments here and related issues, I get the impression that it worked at some time as long as the dependent project was first built manually?

So, is there any way to avoid the “Either the project type is not supported or the project is not loaded in the solution” error when starting debug from VS when the relevant project is not in the solution?

Yes I think we should enable this. But you also want debugging inside of the IDE as well right?

I think that’s what we’d do. If it’s not added as a reference to the apphost then we build it. Not sure what else we can glean.