Add net8.0-maccatalyst TFM to Microsoft.Identity.Client - #5863
Add net8.0-maccatalyst TFM to Microsoft.Identity.Client#5863Matthew Leibowitz (mattleibow) wants to merge 4 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
Adds net8.0-maccatalyst support to MSAL.NET so Mac Catalyst apps consume the platform-specific build (reusing existing iOS UIKit implementation) and updates build/sample infrastructure accordingly.
Changes:
- Added
net8.0-maccatalystTFM wiring + compiler constants and iOS source inclusion for the new target. - Differentiated telemetry product name for Mac Catalyst.
- Updated MAUI dev apps/CI to build against .NET 8 and install/build Mac Catalyst workloads.
Reviewed changes
Copilot reviewed 7 out of 9 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/devapps/MauiApps/MauiAppWithBroker/MauiAppWithBroker.csproj | Bumps MAUI app TFMs to net8.0 variants. |
| tests/devapps/MauiApps/MauiAppBasic/MauiAppBasic.csproj | Updates TFMs and iOS-specific IPA build conditions to net8.0. |
| tests/devapps/MauiApps/MauiAppB2C/MauiB2C.csproj | Bumps MAUI app TFMs to net8.0 variants. |
| src/client/Microsoft.Identity.Client/PublicApi/net8.0-maccatalyst/PublicAPI.Shipped.txt | Adds public API baseline for the new TFM. |
| src/client/Microsoft.Identity.Client/Platforms/iOS/iOSPlatformProxy.cs | Uses a distinct product name for Mac Catalyst telemetry. |
| src/client/Microsoft.Identity.Client/Microsoft.Identity.Client.csproj | Introduces net8.0-maccatalyst target + includes iOS platform sources for it. |
| build/template-build-on-mac.yaml | Adds Mac Catalyst workload install and builds for MSAL + Mac MAUI app. |
| build/platform_and_feature_flags.props | Adds MACCATALYST/iOS/MOBILE constants for the new TFM. |
65d1831 to
8c81002
Compare
Add Mac Catalyst target framework moniker (net8.0-maccatalyst) to the main MSAL.NET library. Mac Catalyst uses UIKit like iOS, so the existing iOS platform code (keychain, broker, webviews, HTTP client) is reused directly without duplication. Changes: - Add TargetFrameworkNetMacCatalyst property and include in multi-target builds - Define MACCATALYST and iOS compilation symbols for Mac Catalyst - Add SupportedOSPlatformVersion 14.0 for Mac Catalyst - Reuse Platforms/iOS source files for Mac Catalyst target - Add JSON build infrastructure DefineConstants (same as iOS) - Create PublicApi/net8.0-maccatalyst tracking files (copied from iOS) - Differentiate product name telemetry (MSAL.MacCatalyst vs MSAL.Xamarin.iOS) - Update CI mac build template with maccatalyst workload and build steps This enables Mac Catalyst apps to get full platform-specific MSAL functionality (keychain token caching, ASWebAuthenticationSession, broker support, NSUrlSessionHandler) instead of falling back to the generic netstandard2.0 build. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
8c81002 to
ff9662b
Compare
There was a problem hiding this comment.
Pull request overview
This PR adds a net8.0-maccatalyst target to Microsoft.Identity.Client so Mac Catalyst apps can consume the iOS platform implementation (Keychain cache, ASWebAuthenticationSession / WKWebView, broker hooks, etc.) instead of falling back to the netstandard2.0 build.
Changes:
- Adds
net8.0-maccatalystTFM toMicrosoft.Identity.Client.csproj, reusingPlatforms/iOS/**/*.csfor compilation. - Introduces
MACCATALYST+iOScompilation symbols (andMOBILE) for the Mac Catalyst TFM viaplatform_and_feature_flags.props. - Adds Mac Catalyst public API tracking files and updates iOS telemetry product name to distinguish Mac Catalyst vs iOS.
Reviewed changes
Copilot reviewed 3 out of 5 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/client/Microsoft.Identity.Client/Microsoft.Identity.Client.csproj | Adds Mac Catalyst TFM, sets SupportedOSPlatformVersion, reuses iOS sources for Mac Catalyst, wires PublicAPI files for the new TFM. |
| build/platform_and_feature_flags.props | Defines MACCATALYST;iOS;SUPPORTS_BROKER and MOBILE constants for the new TFM. |
| src/client/Microsoft.Identity.Client/Platforms/iOS/iOSPlatformProxy.cs | Adjusts telemetry product name when compiling for Mac Catalyst. |
| src/client/Microsoft.Identity.Client/PublicApi/net8.0-maccatalyst/PublicAPI.Shipped.txt | Adds the shipped public API baseline for the new net8.0-maccatalyst target. |
There was a problem hiding this comment.
Pull request overview
Adds a net8.0-maccatalyst target to the main Microsoft.Identity.Client library so Mac Catalyst apps consume the Apple-platform build (reusing the existing iOS platform implementation) instead of falling back to netstandard2.0.
Changes:
- Added
net8.0-maccatalystTFM toMicrosoft.Identity.Client.csproj, sharing iOS compile items and mobile OS platform constraints via combined MSBuild conditions. - Introduced Mac Catalyst compilation constants (
MACCATALYSTplusiOS) and included Mac Catalyst in theMOBILEconstant group. - Added Mac Catalyst PublicAPI baseline files and differentiated iOS vs Mac Catalyst telemetry product name.
Reviewed changes
Copilot reviewed 3 out of 5 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/client/Microsoft.Identity.Client/Microsoft.Identity.Client.csproj | Adds the Mac Catalyst TFM and reuses iOS sources/conditions for compilation and OS platform constraints. |
| build/platform_and_feature_flags.props | Defines MACCATALYST (and iOS) constants for the new TFM and includes it in MOBILE. |
| src/client/Microsoft.Identity.Client/Platforms/iOS/iOSPlatformProxy.cs | Adjusts product name telemetry to report MSAL.MacCatalyst when compiled for Mac Catalyst. |
| src/client/Microsoft.Identity.Client/PublicApi/net8.0-maccatalyst/PublicAPI.Shipped.txt | Introduces the Mac Catalyst public API baseline (matching the iOS surface). |
|
Hello! 👋 Bogdan Gavril (@bgavrilMS) any chance you or someone from the team to have a look at this? |
There was a problem hiding this comment.
Pull request overview
Adds first-class net8.0-maccatalyst targeting to Microsoft.Identity.Client so Mac Catalyst apps consume the platform-specific build (reusing existing iOS implementation) instead of falling back to netstandard2.0.
Changes:
- Add
net8.0-maccatalystTFM and wire it into the project’s conditional TFMs, OS platform versions, constants, and iOS source inclusion. - Introduce Mac Catalyst-specific compilation constants (
MACCATALYSTplusiOS) and include it in theMOBILEconstant group. - Differentiate iOS vs Mac Catalyst product-name telemetry and add public API baseline files for the new TFM.
Reviewed changes
Copilot reviewed 3 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/client/Microsoft.Identity.Client/Microsoft.Identity.Client.csproj | Adds the net8.0-maccatalyst TFM and reuses iOS compilation settings/source includes for this target. |
| build/platform_and_feature_flags.props | Defines MACCATALYST;iOS;SUPPORTS_BROKER and includes Mac Catalyst in MOBILE constants. |
| src/client/Microsoft.Identity.Client/Platforms/iOS/iOSPlatformProxy.cs | Updates telemetry product name to MSAL.MacCatalyst when built for Mac Catalyst. |
| src/client/Microsoft.Identity.Client/PublicApi/net8.0-maccatalyst/PublicAPI.Shipped.txt | Adds public API shipped baseline for the new TFM. |
| src/client/Microsoft.Identity.Client/PublicApi/net8.0-maccatalyst/PublicAPI.Unshipped.txt | Adds unshipped baseline file for the new TFM. |
There was a problem hiding this comment.
should we remove the changes in this file as its whitespaces only?
There was a problem hiding this comment.
It's a new empty baseline file, not whitespace edits — every other TFM (net8.0, ios, android, netstandard, net462/472) also ships an empty PublicAPI.Unshipped.txt. The csproj references it per-TFM via <AdditionalFiles Include="PublicAPI/$(TargetFramework)/PublicAPI.Unshipped.txt" />, so the public API analyzer needs it present for net8.0-maccatalyst; removing it would fail the build under warnings-as-errors. Leaving it in for consistency (maccatalyst mirrors the iOS surface, so the baseline lives in PublicAPI.Shipped.txt with no unshipped additions).
| <PropertyGroup Condition="'$(INCLUDE_MOBILE_AND_LEGACY_TFM)' != ''"> | ||
| <TargetFrameworkNetAndroid>net8.0-android</TargetFrameworkNetAndroid> | ||
| <TargetFrameworkNetIos>net8.0-ios</TargetFrameworkNetIos> | ||
| <TargetFrameworkNetMacCatalyst>net8.0-maccatalyst</TargetFrameworkNetMacCatalyst> |
There was a problem hiding this comment.
Could you verify if adding this new tfm requires any changes in the release pipelines? - https://identitydivision.visualstudio.com/IDDP/_git/MSAL.NET-OneBranch?path=/.pipelines/OneBranch.Official.yml
There was a problem hiding this comment.
Checked the OneBranch templates. iOS isn't baked into the agent image — template-OneBranch-CI-libsandsamples.yaml installs workloads at build time via dotnet workload restore <csproj> + dotnet workload install maui (pack-and-sign and restore-build templates run ... android ios macos maui). The maui meta-workload already bundles Mac Catalyst (Microsoft.MacCatalyst.Ref) alongside iOS, and workload restore reads the csproj TFMs — so net8.0-maccatalyst is picked up by the exact same mechanism that provides iOS today. The new TFM also ships as another lib/ folder inside the existing Microsoft.Identity.Client.nupkg, and the Release push tasks use package-name globs (not per-TFM paths), so no pipeline changes are needed.
Ashok Kumar Ramakrishnan (ashok672)
left a comment
There was a problem hiding this comment.
looks good. there are some comments from Dharshan that I agree with.
Can you take care of those comments
…roccoli # Conflicts: # src/client/Microsoft.Identity.Client/Microsoft.Identity.Client.csproj
Summary
Add Mac Catalyst target framework moniker (
net8.0-maccatalyst) to the main MSAL.NET library so Mac Catalyst apps get full platform-specific functionality instead of falling back to the genericnetstandard2.0build.Problem
The library currently targets
net8.0-iosbut notnet8.0-maccatalyst. This means Mac Catalyst apps (including MAUI apps) consume thenetstandard2.0build, missing:Approach
Mac Catalyst uses UIKit (not AppKit), so all existing iOS platform code (
Platforms/iOS/) is directly compatible. Rather than duplicating ~20 source files into a newPlatforms/MacCatalyst/directory, we reuse the iOS code by:net8.0-maccatalystas a new TFMMACCATALYSTandiOScompilation symbols so existing#if iOScode paths activatePlatforms/iOS/**/*.csfor the Mac Catalyst target (same as the iOS target)orconditions in PropertyGroups and ItemGroups to avoid duplicationChanges
Core Library (
Microsoft.Identity.Client.csproj)TargetFrameworkNetMacCatalystproperty (net8.0-maccatalyst)SupportedOSPlatformVersion14.0 for Mac Catalystorconditions (no duplication)TargetFrameworksfor Windows and OSX build platformsBuild Flags (
platform_and_feature_flags.props)MACCATALYST;iOS;SUPPORTS_BROKERconstants for Mac CatalystMOBILEgroup alongside Android and iOSPlatform Proxy (
iOSPlatformProxy.cs)MSAL.MacCatalystwhen on Mac Catalyst,MSAL.Xamarin.iOSon iOSPublic API (
PublicApi/net8.0-maccatalyst/)PublicAPI.Shipped.txt(copied from iOS — same API surface)PublicAPI.Unshipped.txtBuild Validation
Successfully built all TFMs on macOS with 0 warnings, 0 errors:
net8.0-maccatalyst✅net8.0-ios✅netstandard2.0✅net8.0✅