Skip to content

[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

Description

@v-elenafeng

REGRESSION INFO

Reproduces with VS 17.10 Preview 3 (Includes Aspire 8.0 P4) + Aspire 8.0 P5

INSTALL STEPS

Clean machine: Win11 x64 23h2 ENU

  1. Install VS 17.10 Preview 3 from VS/main

    • Web Workload + Maui workload
    • Includes Aspire 8.0 Preview 4
    • Includes SDK 8.0.300-preview.24122.6
  2. Create .NET MAUI App 8.0 and build

  3. Right click the project > Add ".NET Aspire Orchestrator Support" > Build

ACTUAL
error MSB4057: The target "GetTargetPath" does not exist in the project.
image

This issue also reproduces with "Only Maui workload"

EXPECTED
The .NET MAUI App can be built successfully with ".NET Aspire Orchestrator Support".

Activity

  1. eerhardt commented on Mar 25, 2024

    @eerhardt
    Member

    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.

  2. eerhardt commented on Mar 26, 2024

    @eerhardt
    Member

    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?

  3. v-elenafeng commented on Mar 27, 2024

    @v-elenafeng
    Author

    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.

  4. locked and limited conversation to collaborators on Apr 26, 2024
  5. BillHiebert commented on Jul 15, 2024

    @BillHiebert
    Contributor

    Need to investigate this.

  6. unlocked this conversation on Jul 15, 2024
  7. BretJohnson commented on Jul 15, 2024

    @BretJohnson

    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.

  8. v-elenafeng commented on Jul 17, 2024

    @v-elenafeng
    Author

    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.

    image
    image

  9. BillHiebert commented on Jul 17, 2024

    @BillHiebert
    Contributor

    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.

  10. 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
  11. added
    area-app-model
    on Dec 18, 2024
  12. DrLeh commented on Apr 17, 2025

    @DrLeh

    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

  13. papuashu commented on Jun 27, 2025

    @papuashu

    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.

  14. ntomasn commented on Feb 18, 2026

    @ntomasn

    The problem with multi-targeting projects and the App Host can be solved using a MSBuild Target Element.

    <Project Sdk="Microsoft.NET.Sdk.Web">
    	<PropertyGroup>
    		<TargetFrameworks>net10.0</TargetFrameworks>
    	</PropertyGroup>
    
    	<Target Name="GetTargetPath" Returns="net10.0" />
    </Project>
    
  15. Schinwinkwinsky commented on Jul 30, 2026

    @Schinwinkwinsky

    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

  16. dosolkowski-work commented on Aug 5, 2026

    @dosolkowski-work

    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.

  17. xaberue commented on Nov 7, 2026

    @xaberue

    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

    that one saved my day, I agree that either the MAUI docs need to be updated, or directly point to the Aspire documentation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-app-model

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions