[AspireE2E] Running a MAUI App on Android Emulator Fails with error "NETSDK1085: The 'NoBuild' property was set to true but the 'Build' target was invoked" after adding the Maui integration
- Dominant language
- C#
- Stars
- 6.3k
- Forks
- 991
- Avg merge
- 2d 15h
- Merged PRs (30d)
- 196
Description
**REGRESSION INFO:** work well on Aspire 13.4.6
**INSTALL STEPS**
1. Clean machine: Win11 x64 25h2 ENU
1. Install SDK 10.0.302
1. Add feed
1. Install Aspire 13.5 CLI` iex "& { $(irm https://aspire.dev/install.ps1) } -Quality dev"`
2. Install the devtunnel CLI: `winget install Microsoft.devtunnel`
1. Install Install Android Studio:https://developer.android.com/studio
**REPRO STEPS**
1. Open a normal Command Prompt
2. Install the MAUI workload:
`dotnet workload install maui`
2. create an Aspire starter App project and go to the project
```
aspire new aspire-starter -o AspireWithMaui
cd AspireWithMaui
```
4. Create a .NET MAUI Blazor Hybrid App project:
`dotnet new maui-blazor -o AspireWithMaui.MauiClient`
5. Add the maui project to the soultion.
`dotnet sln add AspireWithMaui.MauiClient/AspireWithMaui.MauiClient.csproj`
6. Go to AspireStarterApp.AppHost project, add MAUI and devtunnels integration
```
cd AspireWithMaui.AppHost
aspire add maui
aspire add devtunnels
```
8. Open the AppHost.cs file of AspireWithMaui.AppHost project, add the following code:
```
// To easily reach your local API project from the emulator/Simulator/physical device, you can use the Dev Tunnels integration
var publicDevTunnel = builder.AddDevTunnel("devtunnel-public")
.WithAnonymousAccess()
.WithReference(apiService.GetEndpoint("https"));
// Add the .NET MAUI project resource
var mauiapp = builder.AddMauiProject("myapp", @"../AspireWithMaui.MauiClient/AspireWithMaui.MauiClient.csproj");
// Add MAUI app for Android running on the emulator with default emulator (uses running or default emulator, needs to be started)
mauiapp.AddAndroidEmulator()
.WithOtlpDevTunnel() // Needed to get the OpenTelemetry data to "localhost"
.WithReference(apiService, publicDevTunnel); // Needs a dev tunnel to reach "localhost"
```
9. Login into dev tunnels.
`devtunnel user login`
10. Run the Aspire project: `aspire run`
1. Open the Dashboard URL in browser
2. Start the myapp-android-emulator project manually
**Note:**
1. This issue does not repro on Windows devices.
2. This issue also repro on .NET 10.0.301/10.0.400-preview + Aspire CLI 13.5
3. There is a known issue when using .NET 10.0.301 + Aspire CLI 13.4.6: https://github.com/microsoft/aspire/issues/16919
**ACTUAL**
Fail to run the Maui project in Android Emulator.
**Error Log**
```
Executing command 'start'.
Building project 'myapp' for myapp-android-emulator.
Running: dotnet build C:\Users\v-xinyfe\AspireWithMaui\AspireWithMaui.MauiClient\AspireWithMaui.MauiClient.csproj -f net10.0-android --configuration Debug -p:AdbTarget=-e
Determining projects to restore...
All projects are up-to-date for restore.
XAML source generation is enabled (MauiXamlInflator=SourceGen). This generates C# code from XAML at compile time for better performance. To disable, remove the MauiXamlInflator line from your .csproj file (reverts to configuration-based defaults: Runtime in Debug, XamlC in Release).
AspireWithMaui.MauiClient -> C:\Users\v-xinyfe\AspireWithMaui\AspireWithMaui.MauiClient\bin\Debug\net10.0-android\AspireWithMaui.MauiClient.dll
Build succeeded.
0 Warning(s)
0 Error(s)
Time Elapsed 00:00:02.24
Build succeeded for resource 'myapp-android-emulator'.
Successfully executed command 'start'.
[sys] Starting process...: Cmd = C:\Program Files\dotnet\dotnet.exe, Args = ["build", "--no-restore", "/t:Run", "-p:NoBuild=true", "C:\\Users\\v-xinyfe\\AspireWithMaui\\AspireWithMaui.MauiClient\\AspireWithMaui.MauiClient.csproj", "--configuration", "Debug", "-f", "net10.0-android", "-p:AdbTarget=-e", "-p:CustomAfterMicrosoftCommonTargets=C:\\Users\\v-xinyfe\\AppData\\Local\\Temp\\aspire-maui-android-envgucr33ke.om1\\myapp-android-emulator-android-51db9f5182764d6f821aa1dbd55989c1.targets"]
Released build lock (resource 'myapp-android-emulator').
C:\Program Files\dotnet\sdk\10.0.302\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.targets(262,5): error NETSDK1085: The 'NoBuild' property was set to true but the 'Build' target was invoked. [C:\Users\v-xinyfe\AspireWithMaui\AspireWithMaui.MauiClient\AspireWithMaui.MauiClient.csproj::TargetFramework=net10.0-android]
Build FAILED.
C:\Program Files\dotnet\sdk\10.0.302\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.targets(262,5): error NETSDK1085: The 'NoBuild' property was set to true but the 'Build' target was invoked. [C:\Users\v-xinyfe\AspireWithMaui\AspireWithMaui.MauiClient\AspireWithMaui.MauiClient.csproj::TargetFramework=net10.0-android]
0 Warning(s)
1 Error(s)
Time Elapsed 00:00:01.45
```
Contributor guide
Research direction
Reproduce the failure using the listed Aspire CLI, .NET SDK, MAUI workload, Android emulator, and AppHost.cs setup. Compare the successful build with the later `dotnet build --no-restore /t:Run -p:NoBuild=true` invocation for the MAUI project and trace where that command is assembled. Done means starting `myapp-android-emulator` completes without NETSDK1085.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, csharp
- Domain
- mobile-dev, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100