Description
Android application type
.NET Android (net7.0-android, net8.0-android, etc.)
Affected platform version
.NET 7,8,9
Description
When you build an Android project, we have logic that "finds" the property $(RuntimeIdentifier)
for the attached device:
If you have no device attached, it just builds all 4 $(RuntimeIdentifiers)
.
Problem
This can slow down the 1st time experience for MAUI on Android, as there would be no emulators running or Android devices attached. This builds 4 architectures for no reason.
Solution 1
The IDE passes $(RuntimeIdentifier)
to builds. This could be problematic as right now project defaults are:
<RuntimeIdentifier></RuntimeIdentifier>
<RuntimeIdentifiers>android-arm;android-arm64;android-x86;android-x64</RuntimeIdentifiers>
<AppendRuntimeIdentifierToOutputPath>true</AppendRuntimeIdentifierToOutputPath>
<AppendRuntimeIdentifierToIntermediateOutputPath>true</AppendRuntimeIdentifierToIntermediateOutputPath>
This could have unforseen consequences, in trying to use RID for this. There are many general issues about RIDs in multi-targeted projects:
- Make it possible to choose a different default RuntimeIdentifier between build and publish for SDKs sdk#27253
- Specifying both -f ... and -r ... to dotnet build fails to restore if multiple frameworks are present in the project file sdk#21877
Solution 2
Invent a new property that would skip the <GetPrimaryCpu/>
task and just set appropriate properties instead.
Steps to Reproduce
- File > New MAUI project
- Run in VS without an emulator running or device attached
Did you find any workaround?
No response
Relevant log output
No response