You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[WebToolsE2E][Aspire] Building a multi-target project from the App Host (e.g., .NET MAUI App with ".NET Aspire Orchestrator Support") fails with error MSB4057: The target "GetTargetPath" does not exist in the project. #3043
I don't have MAUI installed locally. Can someone attach a binlog of the failing build, so we can see where it is coming from? That link has instructions on how to enable it for VS.
v-elenafeng - the binlog at that location is for a build that succeeded. Can you grab the log for a build that fails with the above error?
I grabbed the binlog after the build in VS showed a failure, but it wasn't captured in the logs, so I ran "dotnet build" the solution using CLI and the build was successful as well. So I will move this to DevOps since it's like a VS tooling issue.
Btw, I deleted the comment posted above since it's an internal shared path.
Note that this issue looks to affect all multitargetted projects, not just MAUI. I created a Console app with <TargetFrameworks>net9.0;net8.0</TargetFrameworks> and saw the same The target "GetTargetPath" does not exist in the project error.
Reacted by moljac, Andrei Kurosh and Christian Schneider
Yes, when adding '.NET Aspire Orchestrator Support' to a multi-target project, it keeps the AppHost single-targeted, so building the project throws an error. This can be fixed by modifying the AppHost project to be multi-targeted.
I don't think multi-targeting AppHost is the right thing to do here. Since AppHost does not reference types from the referenced projects, I think it is better is to add the PrivateAssets="All" and ReferenceOutputAssembly="false" attributes to the project reference.
changed the title [-][WebToolsE2E][Aspire] Building .NET MAUI App with ".NET Aspire Orchestrator Support" fails with error MSB4057: The target "GetTargetPath" does not exist in the project.[/-]on Aug 16, 2024
I encountered this today. if the aspire host uses <TargetFrameworks> (plural), even with only one target I get this error. I changed it to <TargetFramework> (singular) and it went away
I ran into same problem as v-elenafeng ... I got around it by targeting Windows runtime only in my Blazor Hybrid (MAUI) project and using TargetFramework (singular) element. It's fine as long as I target Windows only; probably a separate build / deploy for MAUI multi-targeted project would do it.
Bill Hiebert (@BillHiebert)'s original suggestion of changing the project references did not work. Adding <Target Name="GetTargetPath" Returns="net10.0" /> to the project files of the referenced projects did stop the error, but somehow even with that in place and using .WithArgs("--framework", "net10.0") when adding a project to a host, Aspire is still running the .NET 8 version instead of the .NET 10 version. In combination with #17912, it seems like multi-targeting of any kind in combination with Aspire is not supported.
Activity
eerhardt commentedon Mar 25, 2024
I don't have MAUI installed locally. Can someone attach a binlog of the failing build, so we can see where it is coming from? That link has instructions on how to enable it for VS.
eerhardt commentedon Mar 26, 2024
v-elenafeng - the binlog at that location is for a build that succeeded. Can you grab the log for a build that fails with the above error?
v-elenafeng commentedon Mar 27, 2024
I grabbed the binlog after the build in VS showed a failure, but it wasn't captured in the logs, so I ran "dotnet build" the solution using CLI and the build was successful as well. So I will move this to DevOps since it's like a VS tooling issue.
Btw, I deleted the comment posted above since it's an internal shared path.
BillHiebert commentedon Jul 15, 2024
Need to investigate this.
BretJohnson commentedon Jul 15, 2024
Note that this issue looks to affect all multitargetted projects, not just MAUI. I created a Console app with
<TargetFrameworks>net9.0;net8.0</TargetFrameworks>and saw the sameThe target "GetTargetPath" does not exist in the projecterror.v-elenafeng commentedon Jul 17, 2024
Yes, when adding '.NET Aspire Orchestrator Support' to a multi-target project, it keeps the AppHost single-targeted, so building the project throws an error. This can be fixed by modifying the AppHost project to be multi-targeted.
BillHiebert commentedon Jul 17, 2024
I don't think multi-targeting AppHost is the right thing to do here. Since AppHost does not reference types from the referenced projects, I think it is better is to add the PrivateAssets="All" and ReferenceOutputAssembly="false" attributes to the project reference.
[-][WebToolsE2E][Aspire] Building .NET MAUI App with ".NET Aspire Orchestrator Support" fails with error MSB4057: The target "GetTargetPath" does not exist in the project.[/-]DrLeh commentedon Apr 17, 2025
I encountered this today. if the aspire host uses
<TargetFrameworks>(plural), even with only one target I get this error. I changed it to<TargetFramework>(singular) and it went awaypapuashu commentedon Jun 27, 2025
I ran into same problem as v-elenafeng ... I got around it by targeting Windows runtime only in my Blazor Hybrid (MAUI) project and using TargetFramework (singular) element. It's fine as long as I target Windows only; probably a separate build / deploy for MAUI multi-targeted project would do it.
ntomasn commentedon Feb 18, 2026
The problem with multi-targeting projects and the App Host can be solved using a MSBuild Target Element.
Schinwinkwinsky commentedon Jul 30, 2026
I faced this problem today. Remove the Maui.Client project reference from AppHost project.
The Aspire docs alert about that: Aspire Maui Integration
The Maui docs need to be updated: .Net Maui integration to Aspire
dosolkowski-work commentedon Aug 5, 2026
Bill Hiebert (@BillHiebert)'s original suggestion of changing the project references did not work. Adding
<Target Name="GetTargetPath" Returns="net10.0" />to the project files of the referenced projects did stop the error, but somehow even with that in place and using.WithArgs("--framework", "net10.0")when adding a project to a host, Aspire is still running the .NET 8 version instead of the .NET 10 version. In combination with #17912, it seems like multi-targeting of any kind in combination with Aspire is not supported.xaberue commentedon Nov 7, 2026
that one saved my day, I agree that either the MAUI docs need to be updated, or directly point to the Aspire documentation.