Skip to content

[msbuild/dotnet] Use 'SdkIsSimulator' instead of 'ComputedPlatform'.#25234

Draft
rolfbjarne wants to merge 7 commits intomainfrom
dev/rolf/msbuild-computedplatform
Draft

[msbuild/dotnet] Use 'SdkIsSimulator' instead of 'ComputedPlatform'.#25234
rolfbjarne wants to merge 7 commits intomainfrom
dev/rolf/msbuild-computedplatform

Conversation

@rolfbjarne
Copy link
Copy Markdown
Member

This simplifies the code, since we only have a single property as the source
of truth whether we're building for the simulator or not.

This simplifies the code, since we only have a single property as the source
of truth whether we're building for the simulator or not.
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR replaces uses of $(ComputedPlatform) with $(SdkIsSimulator) across MSBuild and SDK-style targets to make simulator-vs-device detection rely on a single source of truth.

Changes:

  • Updated multiple MSBuild target conditions to use $(SdkIsSimulator) instead of $(ComputedPlatform).
  • Moved/added ComputedPlatform definition into dotnet/targets/Xamarin.Shared.Sdk.props for compatibility with external consumers.
  • Removed the old ComputedPlatform initialization snippet from Xamarin.Shared.Sdk.DefaultItems.targets.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
tests/monotouch-test/dotnet/shared.csproj Uses SdkIsSimulator for defining AOT in test builds.
tests/ComputeRegistrarConstant.targets Uses SdkIsSimulator to compute dynamic registrar constant for iOS/tvOS.
msbuild/Xamarin.iOS.Tasks.Windows/Xamarin.iOS.Common.After.targets Uses SdkIsSimulator to gate IPA/dSYM copy-back steps from the Mac build host.
msbuild/Xamarin.Shared/Xamarin.iOS.Common.targets Uses SdkIsSimulator to gate iTunes metadata/artwork targets.
msbuild/Xamarin.Shared/Xamarin.Shared.targets Uses SdkIsSimulator to gate _PrepareResourceRules.
msbuild/Xamarin.Shared/Xamarin.Shared.props Removes ComputedPlatform computation and switches certain defaults to SdkIsSimulator.
dotnet/targets/Xamarin.Shared.Sdk.targets Uses SdkIsSimulator for link-mode defaults previously keyed off ComputedPlatform.
dotnet/targets/Xamarin.Shared.Sdk.props Exposes SdkIsSimulator and redefines ComputedPlatform for compatibility.
dotnet/targets/Xamarin.Shared.Sdk.DefaultItems.targets Removes the previous ComputedPlatform initialization block.

</Target>

<Target Name="CopyIpaFromMac" Condition="'$(OutputType)' == 'Exe' And '$(ComputedPlatform)' == 'iPhone' And '$(BuildIpa)' == 'true'">
<Target Name="CopyIpaFromMac" Condition="'$(OutputType)' == 'Exe' And '$(SdkIsSimulator)' != 'true' And '$(BuildIpa)' == 'true'">
</Target>

<Target Name="CopyDSYMFromMac" DependsOnTargets="_SayHello" Condition="'$(IsMacEnabled)' == 'true' And '$(IsAppExtension)' == 'false' And '$(ComputedPlatform)' == 'iPhone' And '$(CopyDSYM)' == 'true' And ('$(BuildIpa)' == 'true' Or '$(CopyAppBundle)' == 'true')" BeforeTargets="BeforeDisconnect">
<Target Name="CopyDSYMFromMac" DependsOnTargets="_SayHello" Condition="'$(IsMacEnabled)' == 'true' And '$(IsAppExtension)' == 'false' And '$(SdkIsSimulator)' != 'true' And '$(CopyDSYM)' == 'true' And ('$(BuildIpa)' == 'true' Or '$(CopyAppBundle)' == 'true')" BeforeTargets="BeforeDisconnect">
Comment thread dotnet/targets/Xamarin.Shared.Sdk.props Outdated
Comment on lines +152 to +153
<ComputedPlatform Condition="'$(SdkIsSimulator)' == 'true'">iPhoneSimulator</ComputedPlatform>
<ComputedPlatform Condition="'$(ComputedPlatform)' == ''">iPhone</ComputedPlatform>
Comment on lines 112 to 114
<Target Name="_CompileITunesMetadata" Condition="'$(SdkIsSimulator)' != 'true' And '$(IsAppExtension)' == 'false' And '$(IsWatchApp)' == 'false'"
DependsOnTargets="$(_CompileITunesMetadataDependsOn)"
Inputs="@(ITunesMetadata)"
Comment on lines 127 to 129
<Target Name="_CollectITunesArtwork" Condition="'$(SdkIsSimulator)' != 'true' And '$(IsAppExtension)' == 'false' And '$(IsWatchApp)' == 'false'">
<CollectITunesArtwork
SessionId="$(BuildSessionId)"
Comment on lines 137 to 139
<Target Name="_CopyITunesArtwork" Condition="'$(SdkIsSimulator)' != 'true' And '$(IsAppExtension)' == 'false' And '$(IsWatchApp)' == 'false'"
DependsOnTargets="_CollectITunesArtwork"
Inputs="@(_ITunesArtworkWithLogicalName)" Outputs="$(DeviceSpecificOutputPath)%(_ITunesArtworkWithLogicalName.LogicalName)">
<PrepareResourceRules
SessionId="$(BuildSessionId)"
Condition="'$(IsMacEnabled)' == 'true' And '$(CodesignResourceRules)' != '' And '$(ComputedPlatform)' == 'iPhone'"
Condition="'$(IsMacEnabled)' == 'true' And '$(CodesignResourceRules)' != '' And '$(SdkIsSimulator)' != 'true'"
@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

rolfbjarne and others added 5 commits April 30, 2026 11:52
Only set ComputedPlatform for iOS and tvOS (like the old behavior).
Introduce a new SdkIsDevice property that's set to true when building
for device (iOS and tvOS only), and use it to retain the original
behavior of ComputedPlatform == 'iPhone' wherever needed.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2
Copy link
Copy Markdown
Collaborator

✅ [PR Build #1892441] Build passed (Build packages) ✅

Pipeline on Agent
Hash: 1892441b883e37c2506a4f342cd2781d376d2e42 [PR build]

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2
Copy link
Copy Markdown
Collaborator

✅ [PR Build #1892441] Build passed (Detect API changes) ✅

Pipeline on Agent
Hash: 1892441b883e37c2506a4f342cd2781d376d2e42 [PR build]

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2
Copy link
Copy Markdown
Collaborator

✅ API diff for current PR / commit

NET (empty diffs)

✅ API diff vs stable

NET (empty diffs)

ℹ️ Generator diff

Generator Diff: vsdrops (html) vsdrops (raw diff) gist (raw diff) - Please review changes)

Pipeline on Agent
Hash: 1892441b883e37c2506a4f342cd2781d376d2e42 [PR build]

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2
Copy link
Copy Markdown
Collaborator

✅ [CI Build #1892441] Build passed (Build macOS tests) ✅

Pipeline on Agent
Hash: 1892441b883e37c2506a4f342cd2781d376d2e42 [PR build]

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2
Copy link
Copy Markdown
Collaborator

🔥 [CI Build #1892441] Test results 🔥

Test results

❌ Tests failed on VSTS: test results

3 tests crashed, 1 tests failed, 144 tests passed.

Failures

❌ framework tests

🔥 Failed catastrophically on VSTS: test results - framework (no summary found).

Html Report (VSDrops) Download

❌ introspection tests

🔥 Failed catastrophically on VSTS: test results - introspection (no summary found).

Html Report (VSDrops) Download

❌ windows tests

🔥 Failed catastrophically on VSTS: test results - windows (no summary found).

Html Report (VSDrops) Download

❌ Tests on macOS Tahoe (26) tests

1 tests failed, 4 tests passed.

Failed tests

  • monotouch-test: Failed (exit code 2)
    • TestCancel : Connection timed out.
    • TestEndpointProperty : Connection timed out.
    • TestForceCancel : Connection timed out.
    • ... and 135 more failures

Html Report (VSDrops) Download

Successes

✅ cecil: All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (iOS): All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (MacCatalyst): All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (macOS): All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (Multiple platforms): All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (tvOS): All 1 tests passed. Html Report (VSDrops) Download
✅ fsharp: All 4 tests passed. Html Report (VSDrops) Download
✅ generator: All 5 tests passed. Html Report (VSDrops) Download
✅ interdependent-binding-projects: All 4 tests passed. Html Report (VSDrops) Download
✅ linker: All 44 tests passed. Html Report (VSDrops) Download
✅ monotouch (iOS): All 11 tests passed. Html Report (VSDrops) Download
✅ monotouch (MacCatalyst): All 15 tests passed. Html Report (VSDrops) Download
✅ monotouch (macOS): All 12 tests passed. Html Report (VSDrops) Download
✅ monotouch (tvOS): All 11 tests passed. Html Report (VSDrops) Download
✅ msbuild: All 2 tests passed. Html Report (VSDrops) Download
✅ sharpie: All 1 tests passed. Html Report (VSDrops) Download
✅ xcframework: All 4 tests passed. Html Report (VSDrops) Download
✅ xtro: All 1 tests passed. Html Report (VSDrops) Download

macOS tests

✅ Tests on macOS Monterey (12): All 5 tests passed. Html Report (VSDrops) Download
✅ Tests on macOS Ventura (13): All 5 tests passed. Html Report (VSDrops) Download
✅ Tests on macOS Sonoma (14): All 5 tests passed. Html Report (VSDrops) Download
✅ Tests on macOS Sequoia (15): All 5 tests passed. Html Report (VSDrops) Download

Linux Build Verification

Linux build succeeded

Pipeline on Agent
Hash: 1892441b883e37c2506a4f342cd2781d376d2e42 [PR build]

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants