Fix NativeAOT custom release configurations - #12451
Conversation
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: e48442c2-2acb-4228-9eec-4b7930738a0f
There was a problem hiding this comment.
Pull request overview
Adds a new MSBuildDeviceIntegration device regression test intended to cover NativeAOT builds/publishes using a custom “release-like” configuration name (AppStore) and validate the produced APK can be installed and launched on-device, matching the scenario from #10851.
Changes:
- Adds
NativeAOTCustomReleaseConfigurationdevice test parameterized overdotnet buildvsdotnet publish. - Uses a custom release configuration name (
AppStore) while setting Release-like MSBuild properties (Optimize=true,DebugType=None). - Installs the produced signed APK via
adband asserts the activity launches.
Suppressed comments (1)
tests/MSBuildDeviceIntegration/Tests/InstallAndRunTests.cs:2786
adb installoutput commonly includes additional lines (e.g., "Performing Streamed Install") before "Success". UsingAssert.AreEqual("Success", ...)can make the test fail even when install succeeded; assert that the output contains "Success" instead.
Assert.AreEqual ("Success", RunAdbCommand ($"install -r \"{apk}\"").Trim (), "APK should install.");
Select NativeAOT for publish or optimized builds while keeping unoptimized Debug builds on CoreCLR. Resolve NativeAOT runtime-pack libraries by optimization flavor instead of the project configuration name. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: e48442c2-2acb-4228-9eec-4b7930738a0f
Disable the ILC publish-target import when PublishAot is used with a non-NativeAOT runtime, while preserving analyzer behavior. Ensure solution tests requesting NativeAOT actually build their Release configurations. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: e48442c2-2acb-4228-9eec-4b7930738a0f
| <_AndroidNativeAotRuntimeFlavor Condition=" '$(_AndroidNativeAotRuntimeFlavor)' == '' ">debug</_AndroidNativeAotRuntimeFlavor> | ||
| <_AndroidNativeAotRuntimeLibraryName>libnaot-android.$(_AndroidNativeAotRuntimeFlavor)-static-$(_AndroidNativeAotRuntimeFlavor)</_AndroidNativeAotRuntimeLibraryName> |
There was a problem hiding this comment.
Now this is confusing to me, what does $(_AndroidNativeAotRuntimeLibraryName)='libnaot-android.debug-static-debug' even mean? there's nothing like "nativeaot debug" -> that's just CoreCLR debug.
There was a problem hiding this comment.
This seems weird/hallucinated.
Looking at the MSBuild code, it might be a no-op so can remove some weird stuff here.
NativeAOT runtime-pack libraries only have
debugandreleaseflavors, but the Android targets derived their names from$(Configuration). Custom release-like configurations such asAppStoretherefore tried to resolve nonexistent runtime libraries.This change:
PublishAot=true$(Optimize)instead of the configuration nameAppStoreconfiguration, including install and launch verificationFixes: #10851