Remove dead OnlyAndroid method from integration tests#34517
Merged
Conversation
The OnlyAndroid method in BaseTemplateTests searches for a static TargetFrameworks string that no longer exists in MAUI templates. Since PR #33576 on net11.0, templates use MSBuild conditions to restrict TargetFrameworks to Android-only on Linux, making OnlyAndroid a silent no-op. Removing the method and its 3 call sites: - AOTTemplateTest.PublishNativeAOT - AOTTemplateTest.PublishNativeAOTRootAllMauiAssemblies - SimpleTemplateTest.Build This also prevents merge conflicts when merging main into net11.0, where OnlyAndroid was already removed. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.sh | bash -s -- 34517Or
iex "& { $(irm https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.ps1) } 34517" |
rmarinho
approved these changes
Mar 18, 2026
This was referenced Mar 19, 2026
KarthikRajaKalaimani
pushed a commit
to KarthikRajaKalaimani/maui
that referenced
this pull request
Mar 30, 2026
<!-- Please let the below note in for people that find this PR --> > [!NOTE] > Are you waiting for the changes in this PR to be merged? > It would be very helpful if you could [test the resulting artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from this PR and let us know in a comment if this change resolves your issue. Thank you! ## Description Removes the dead `OnlyAndroid` method from `BaseTemplateTests` and its 3 call sites in `AOTTemplateTest` and `SimpleTemplateTest`. ### Why this is dead code `OnlyAndroid` calls `ReplaceInFile` searching for: ``` <TargetFrameworks>net10.0-android;net10.0-ios;net10.0-maccatalyst</TargetFrameworks> ``` But MAUI templates now use MSBuild conditions with `DOTNET_TFM-android` placeholders — the static string above no longer exists in generated projects. The method is a silent no-op on every call. ### Why remove it now On `net11.0`, this method was already removed by PR dotnet#33576. When merging `main → net11.0`, the call sites in `AOTTemplateTest.cs` (added by PR dotnet#33756) cause CS0103 build errors since the method does not exist on `net11.0`. Removing it from `main` prevents these merge conflicts going forward. ### Changes - **`BaseTemplateTests.cs`**: Removed `OnlyAndroid` method definition - **`AOTTemplateTest.cs`**: Removed 2 call sites (`PublishNativeAOT`, `PublishNativeAOTRootAllMauiAssemblies`) - **`SimpleTemplateTest.cs`**: Removed 1 call site (`Build`) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Note
Are you waiting for the changes in this PR to be merged?
It would be very helpful if you could test the resulting artifacts from this PR and let us know in a comment if this change resolves your issue. Thank you!
Description
Removes the dead
OnlyAndroidmethod fromBaseTemplateTestsand its 3 call sites inAOTTemplateTestandSimpleTemplateTest.Why this is dead code
OnlyAndroidcallsReplaceInFilesearching for:But MAUI templates now use MSBuild conditions with
DOTNET_TFM-androidplaceholders — the static string above no longer exists in generated projects. The method is a silent no-op on every call.Why remove it now
On
net11.0, this method was already removed by PR #33576. When mergingmain → net11.0, the call sites inAOTTemplateTest.cs(added by PR #33756) cause CS0103 build errors since the method does not exist onnet11.0. Removing it frommainprevents these merge conflicts going forward.Changes
BaseTemplateTests.cs: RemovedOnlyAndroidmethod definitionAOTTemplateTest.cs: Removed 2 call sites (PublishNativeAOT,PublishNativeAOTRootAllMauiAssemblies)SimpleTemplateTest.cs: Removed 1 call site (Build)