From 541088e7270f10f4a06cd9b4f3b270d4cb624eb1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20L=C3=B8bger?= Date: Thu, 11 Sep 2025 23:36:25 +0200 Subject: [PATCH 01/15] Adding to the cheat sheet --- CheatSheet.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CheatSheet.md b/CheatSheet.md index bafe4a7..bd2df89 100644 --- a/CheatSheet.md +++ b/CheatSheet.md @@ -6,3 +6,8 @@ Make a build and write the full log to `publish.log`. Good for debugging MSBuild ``` dotnet publish -f:net9.0-ios --verbosity diagnostic --tl:off MAUI.Native.Embedded.Sample/MAUI.Native.Embedded.Sample.csproj > publish.log ``` + +## See Xcode project settings +``` +xcodebuild -showBuildSettings -scheme MAUI.Native.Embedded.ios -project MAUI.Native.Embedded.Sample/Platforms/iOS/MAUI.Native.Embedded.ios/MAUI.Native.Embedded.ios.xcodeproj +``` From 4b4ed54372acf2fb1ea66fef728e862909c9f048 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20L=C3=B8bger?= Date: Mon, 15 Sep 2025 09:35:23 +0200 Subject: [PATCH 02/15] Include verification when running native embedded test builds --- .../build/MAUI.Native.Embedded.ios.appclips.targets | 2 +- .../build/MAUI.Native.Embedded.ios.widgets.targets | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/MAUI.Native.Embedded.nuget/build/MAUI.Native.Embedded.ios.appclips.targets b/MAUI.Native.Embedded.nuget/build/MAUI.Native.Embedded.ios.appclips.targets index f8f0cb4..c551c10 100644 --- a/MAUI.Native.Embedded.nuget/build/MAUI.Native.Embedded.ios.appclips.targets +++ b/MAUI.Native.Embedded.nuget/build/MAUI.Native.Embedded.ios.appclips.targets @@ -105,7 +105,7 @@ AppClips - + \ No newline at end of file diff --git a/MAUI.Native.Embedded.nuget/build/MAUI.Native.Embedded.ios.widgets.targets b/MAUI.Native.Embedded.nuget/build/MAUI.Native.Embedded.ios.widgets.targets index fe48c8b..8dd7502 100644 --- a/MAUI.Native.Embedded.nuget/build/MAUI.Native.Embedded.ios.widgets.targets +++ b/MAUI.Native.Embedded.nuget/build/MAUI.Native.Embedded.ios.widgets.targets @@ -104,7 +104,7 @@ Widgets - + \ No newline at end of file From 95c3e5a1415e6272e9a0cd5499fe97f1b03fa3e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20L=C3=B8bger?= Date: Mon, 15 Sep 2025 09:36:47 +0200 Subject: [PATCH 03/15] Rearrange xcodebuild parameters to avoid empty line last --- .../build/MAUI.Native.Embedded.ios.common.targets | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/MAUI.Native.Embedded.nuget/build/MAUI.Native.Embedded.ios.common.targets b/MAUI.Native.Embedded.nuget/build/MAUI.Native.Embedded.ios.common.targets index afafb96..f9047b7 100644 --- a/MAUI.Native.Embedded.nuget/build/MAUI.Native.Embedded.ios.common.targets +++ b/MAUI.Native.Embedded.nuget/build/MAUI.Native.Embedded.ios.common.targets @@ -81,8 +81,8 @@ -packageCachePath '%(XcodeProjects._PackageCache)' \ %(XcodeProjects._XcodeProjectVersion) \ %(XcodeProjects._XcodeMarketingVersion) \ - $(XCodeCommonParams) \ - %(XcodeProjects.XcodeParams)" /> + %(XcodeProjects.XcodeParams) \ + $(XCodeCommonParams)" /> - - <_AppClipsMobileProvisioning Condition="'%(AppClips.SkipValidation)' != 'true'" Include="%(AppClips.ArchivePath)/**/AppClips/**/embedded.mobileprovision" /> + + + <_AppClipsMobileProvisioning Condition="'@(AppClipsTarget)' != ''" Include="%(AppClipsTarget.FullPath)/**/AppClips/**/embedded.mobileprovision" /> + Command="xcrun security cms -D -i '%(_AppClipsMobileProvisioning.FullPath)' | xcrun plutil -extract 'Entitlements.com\.apple\.developer\.parent-application-identifiers' xml1 -o - - | grep -q '$(ApplicationId)<'" + IgnoreExitCode="true" + StandardOutputImportance="Low"> - + From 90cc5d0cec3c2b520edf328659f6be6307525028 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20L=C3=B8bger?= Date: Mon, 15 Sep 2025 14:11:43 +0200 Subject: [PATCH 06/15] Use xcrun for all external tools --- .../build/MAUI.Native.Embedded.ios.widgets.targets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MAUI.Native.Embedded.nuget/build/MAUI.Native.Embedded.ios.widgets.targets b/MAUI.Native.Embedded.nuget/build/MAUI.Native.Embedded.ios.widgets.targets index 8dd7502..bbc470a 100644 --- a/MAUI.Native.Embedded.nuget/build/MAUI.Native.Embedded.ios.widgets.targets +++ b/MAUI.Native.Embedded.nuget/build/MAUI.Native.Embedded.ios.widgets.targets @@ -83,7 +83,7 @@ + Command="xcrun security cms -D -i '%(_WidgetsAppexMobileProvision.FullPath)' | xcrun plutil -extract Entitlements xml1 -o - - > '%(_WidgetsAppexMobileProvision.EntitlementPath)'" /> From e05bcd57192b651b021b79a4213ff2de629956a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20L=C3=B8bger?= Date: Mon, 15 Sep 2025 14:13:39 +0200 Subject: [PATCH 07/15] Regroup native embedded for clearity --- MAUI.Native.Embedded.Sample/MAUI.Native.Embedded.Sample.csproj | 2 ++ 1 file changed, 2 insertions(+) diff --git a/MAUI.Native.Embedded.Sample/MAUI.Native.Embedded.Sample.csproj b/MAUI.Native.Embedded.Sample/MAUI.Native.Embedded.Sample.csproj index 1118b4c..12bc74b 100644 --- a/MAUI.Native.Embedded.Sample/MAUI.Native.Embedded.Sample.csproj +++ b/MAUI.Native.Embedded.Sample/MAUI.Native.Embedded.Sample.csproj @@ -53,7 +53,9 @@ + + From 3d0e52ef88d21712ffac49dfb67610d11ba60ecc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20L=C3=B8bger?= Date: Tue, 16 Sep 2025 08:47:42 +0200 Subject: [PATCH 08/15] Adding to cheat sheet --- CheatSheet.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CheatSheet.md b/CheatSheet.md index bd2df89..be1d7e2 100644 --- a/CheatSheet.md +++ b/CheatSheet.md @@ -7,6 +7,13 @@ Make a build and write the full log to `publish.log`. Good for debugging MSBuild dotnet publish -f:net9.0-ios --verbosity diagnostic --tl:off MAUI.Native.Embedded.Sample/MAUI.Native.Embedded.Sample.csproj > publish.log ``` +## Build For iOS Device +In order to build for device (and not simulator) you must provide the `RuntimeIdentifier`. +This makes a debug build for iOS device. +``` +dotnet build -f:net9.0-ios -p:RuntimeIdentifier=ios-arm64 MAUI.Native.Embedded.Sample/MAUI.Native.Embedded.Sample.csproj +``` + ## See Xcode project settings ``` xcodebuild -showBuildSettings -scheme MAUI.Native.Embedded.ios -project MAUI.Native.Embedded.Sample/Platforms/iOS/MAUI.Native.Embedded.ios/MAUI.Native.Embedded.ios.xcodeproj From 78a308726c1f2d4ae8c8b76414259ba641e1226e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20L=C3=B8bger?= Date: Thu, 18 Sep 2025 08:11:45 +0200 Subject: [PATCH 09/15] Change error codes to follow general format --- .../build/MAUI.Native.Embedded.ios.appclips.targets | 6 +++--- .../build/MAUI.Native.Embedded.ios.widgets.targets | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/MAUI.Native.Embedded.nuget/build/MAUI.Native.Embedded.ios.appclips.targets b/MAUI.Native.Embedded.nuget/build/MAUI.Native.Embedded.ios.appclips.targets index 04c406c..9e1e75c 100644 --- a/MAUI.Native.Embedded.nuget/build/MAUI.Native.Embedded.ios.appclips.targets +++ b/MAUI.Native.Embedded.nuget/build/MAUI.Native.Embedded.ios.appclips.targets @@ -34,7 +34,7 @@ - + @@ -63,7 +63,7 @@ <_AppClipsInfoPList Include="%(_AppClipsFiles.FullPath)" Condition="'%(_AppClipsFiles.Filename)%(_AppClipsFiles.Extension)' == 'Info.plist'" /> - + @@ -100,7 +100,7 @@ diff --git a/MAUI.Native.Embedded.nuget/build/MAUI.Native.Embedded.ios.widgets.targets b/MAUI.Native.Embedded.nuget/build/MAUI.Native.Embedded.ios.widgets.targets index bbc470a..6b0acfa 100644 --- a/MAUI.Native.Embedded.nuget/build/MAUI.Native.Embedded.ios.widgets.targets +++ b/MAUI.Native.Embedded.nuget/build/MAUI.Native.Embedded.ios.widgets.targets @@ -34,7 +34,7 @@ - + From a4b5b070f5226359b2669c3e33f4f70a751cf51e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20L=C3=B8bger?= Date: Mon, 22 Sep 2025 13:07:46 +0200 Subject: [PATCH 10/15] Fix for CI/CD to make it build --- .github/workflows/ci.yml | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e05d1f5..1f65364 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,6 +13,18 @@ jobs: - name: Checkout uses: actions/checkout@v2 + - name: Select Xcode version + uses: maxim-lobanov/setup-xcode@v1 + with: + xcode-version: 16.4 + #xcode-version: latest-stable + + - name: Get Xcode Version + id: xcode + uses: ./.github/actions/xcode-version + with: + min_version: '16.4' + - name: Setup .NET uses: actions/setup-dotnet@v4 with: @@ -27,17 +39,6 @@ jobs: - name: Install MAUI workloads run: dotnet workload install maui-ios maui-android - - name: Select Xcode version - uses: maxim-lobanov/setup-xcode@v1 - with: - xcode-version: latest-stable - - - name: Get Xcode Version - id: xcode - uses: ./.github/actions/xcode-version - with: - min_version: '16.4' - - name: Build env: dotnet-target: "${{ steps.xcode.outputs.xcode_min_version != 'true' && '-p:DotNetTarget=8.0' || '' }}" From 35e52c3283fa8335e6c31bccada0a7dee40c6cc6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20L=C3=B8bger?= Date: Wed, 15 Oct 2025 10:44:03 +0200 Subject: [PATCH 11/15] Add shared scemes --- .../MAUI.Native.Embedded.ios.clip.xcscheme | 78 ++++++++++++ .../MAUI.Native.Embedded.ios.widget.xcscheme | 114 ++++++++++++++++++ .../MAUI.Native.Embedded.ios.xcscheme | 78 ++++++++++++ 3 files changed, 270 insertions(+) create mode 100644 MAUI.Native.Embedded.Sample/Platforms/iOS/MAUI.Native.Embedded.ios/MAUI.Native.Embedded.ios.xcodeproj/xcshareddata/xcschemes/MAUI.Native.Embedded.ios.clip.xcscheme create mode 100644 MAUI.Native.Embedded.Sample/Platforms/iOS/MAUI.Native.Embedded.ios/MAUI.Native.Embedded.ios.xcodeproj/xcshareddata/xcschemes/MAUI.Native.Embedded.ios.widget.xcscheme create mode 100644 MAUI.Native.Embedded.Sample/Platforms/iOS/MAUI.Native.Embedded.ios/MAUI.Native.Embedded.ios.xcodeproj/xcshareddata/xcschemes/MAUI.Native.Embedded.ios.xcscheme diff --git a/MAUI.Native.Embedded.Sample/Platforms/iOS/MAUI.Native.Embedded.ios/MAUI.Native.Embedded.ios.xcodeproj/xcshareddata/xcschemes/MAUI.Native.Embedded.ios.clip.xcscheme b/MAUI.Native.Embedded.Sample/Platforms/iOS/MAUI.Native.Embedded.ios/MAUI.Native.Embedded.ios.xcodeproj/xcshareddata/xcschemes/MAUI.Native.Embedded.ios.clip.xcscheme new file mode 100644 index 0000000..3341650 --- /dev/null +++ b/MAUI.Native.Embedded.Sample/Platforms/iOS/MAUI.Native.Embedded.ios/MAUI.Native.Embedded.ios.xcodeproj/xcshareddata/xcschemes/MAUI.Native.Embedded.ios.clip.xcscheme @@ -0,0 +1,78 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/MAUI.Native.Embedded.Sample/Platforms/iOS/MAUI.Native.Embedded.ios/MAUI.Native.Embedded.ios.xcodeproj/xcshareddata/xcschemes/MAUI.Native.Embedded.ios.widget.xcscheme b/MAUI.Native.Embedded.Sample/Platforms/iOS/MAUI.Native.Embedded.ios/MAUI.Native.Embedded.ios.xcodeproj/xcshareddata/xcschemes/MAUI.Native.Embedded.ios.widget.xcscheme new file mode 100644 index 0000000..8d865af --- /dev/null +++ b/MAUI.Native.Embedded.Sample/Platforms/iOS/MAUI.Native.Embedded.ios/MAUI.Native.Embedded.ios.xcodeproj/xcshareddata/xcschemes/MAUI.Native.Embedded.ios.widget.xcscheme @@ -0,0 +1,114 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/MAUI.Native.Embedded.Sample/Platforms/iOS/MAUI.Native.Embedded.ios/MAUI.Native.Embedded.ios.xcodeproj/xcshareddata/xcschemes/MAUI.Native.Embedded.ios.xcscheme b/MAUI.Native.Embedded.Sample/Platforms/iOS/MAUI.Native.Embedded.ios/MAUI.Native.Embedded.ios.xcodeproj/xcshareddata/xcschemes/MAUI.Native.Embedded.ios.xcscheme new file mode 100644 index 0000000..1da329d --- /dev/null +++ b/MAUI.Native.Embedded.Sample/Platforms/iOS/MAUI.Native.Embedded.ios/MAUI.Native.Embedded.ios.xcodeproj/xcshareddata/xcschemes/MAUI.Native.Embedded.ios.xcscheme @@ -0,0 +1,78 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From 1b9e93f8b422d2401a9bf091ca28b4459d999d26 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20L=C3=B8bger?= Date: Thu, 23 Oct 2025 09:35:56 +0200 Subject: [PATCH 12/15] Update cheat sheet with more correct info --- CheatSheet.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CheatSheet.md b/CheatSheet.md index be1d7e2..210a0ac 100644 --- a/CheatSheet.md +++ b/CheatSheet.md @@ -4,14 +4,14 @@ My personal cheat sheet for things to remember ## Build With Full Log Make a build and write the full log to `publish.log`. Good for debugging MSBuild. ``` -dotnet publish -f:net9.0-ios --verbosity diagnostic --tl:off MAUI.Native.Embedded.Sample/MAUI.Native.Embedded.Sample.csproj > publish.log +dotnet publish -f:net9.0-ios -v:diag --tl:off MAUI.Native.Embedded.Sample/MAUI.Native.Embedded.Sample.csproj > publish.log ``` ## Build For iOS Device In order to build for device (and not simulator) you must provide the `RuntimeIdentifier`. This makes a debug build for iOS device. ``` -dotnet build -f:net9.0-ios -p:RuntimeIdentifier=ios-arm64 MAUI.Native.Embedded.Sample/MAUI.Native.Embedded.Sample.csproj +dotnet build -f:net9.0-ios -r:ios-arm64 MAUI.Native.Embedded.Sample/MAUI.Native.Embedded.Sample.csproj ``` ## See Xcode project settings From 0639896f504748359bcbaed11127f5776eef9a68 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20L=C3=B8bger?= Date: Thu, 23 Oct 2025 09:37:01 +0200 Subject: [PATCH 13/15] Add custom task for generating UniqueId based on checksum --- .../MAUI.Native.Embedded.nuget.csproj | 1 + .../build/MAUI.Native.Embedded.tasks.targets | 54 +++++++++++++++++++ .../build/MarLoe.MAUI.Native.Embedded.targets | 2 + 3 files changed, 57 insertions(+) create mode 100644 MAUI.Native.Embedded.nuget/build/MAUI.Native.Embedded.tasks.targets diff --git a/MAUI.Native.Embedded.nuget/MAUI.Native.Embedded.nuget.csproj b/MAUI.Native.Embedded.nuget/MAUI.Native.Embedded.nuget.csproj index df658d5..354b7d6 100644 --- a/MAUI.Native.Embedded.nuget/MAUI.Native.Embedded.nuget.csproj +++ b/MAUI.Native.Embedded.nuget/MAUI.Native.Embedded.nuget.csproj @@ -40,6 +40,7 @@ + diff --git a/MAUI.Native.Embedded.nuget/build/MAUI.Native.Embedded.tasks.targets b/MAUI.Native.Embedded.nuget/build/MAUI.Native.Embedded.tasks.targets new file mode 100644 index 0000000..66ff62d --- /dev/null +++ b/MAUI.Native.Embedded.nuget/build/MAUI.Native.Embedded.tasks.targets @@ -0,0 +1,54 @@ + + + + + + + + + + + + + + + + + + + + () + .Where(k => !k.StartsWith("_")) + .Where(k => !Exclude?.Contains(k) is false) + .Distinct() + .OrderBy(k => k) + .Select(k => $@"{k}={item.GetMetadata(k)}")); + + using (var md5 = MD5.Create()) + { + var digest = md5.ComputeHash(Encoding.UTF8.GetBytes(seed)); + item.SetMetadata("UniqueId", BitConverter.ToString(digest).Replace("-", "").ToLowerInvariant()); + } + } + + OutputItems = Items; + ]]> + + + + + \ No newline at end of file diff --git a/MAUI.Native.Embedded.nuget/build/MarLoe.MAUI.Native.Embedded.targets b/MAUI.Native.Embedded.nuget/build/MarLoe.MAUI.Native.Embedded.targets index 54b8977..6b7b541 100644 --- a/MAUI.Native.Embedded.nuget/build/MarLoe.MAUI.Native.Embedded.targets +++ b/MAUI.Native.Embedded.nuget/build/MarLoe.MAUI.Native.Embedded.targets @@ -1,5 +1,7 @@ + + From 2836df181708a115a4984c241efd7420ca3b6c24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20L=C3=B8bger?= Date: Thu, 23 Oct 2025 09:38:23 +0200 Subject: [PATCH 14/15] Rename internal properties to exclude them from UniqueId checksum --- .../build/MAUI.Native.Embedded.ios.appclips.targets | 6 +++--- .../build/MAUI.Native.Embedded.ios.widgets.targets | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/MAUI.Native.Embedded.nuget/build/MAUI.Native.Embedded.ios.appclips.targets b/MAUI.Native.Embedded.nuget/build/MAUI.Native.Embedded.ios.appclips.targets index 9e1e75c..4ac72fb 100644 --- a/MAUI.Native.Embedded.nuget/build/MAUI.Native.Embedded.ios.appclips.targets +++ b/MAUI.Native.Embedded.nuget/build/MAUI.Native.Embedded.ios.appclips.targets @@ -39,7 +39,7 @@ - true + <_IsAppClips>true @@ -50,9 +50,9 @@ - + - + diff --git a/MAUI.Native.Embedded.nuget/build/MAUI.Native.Embedded.ios.widgets.targets b/MAUI.Native.Embedded.nuget/build/MAUI.Native.Embedded.ios.widgets.targets index 6b0acfa..aa851f5 100644 --- a/MAUI.Native.Embedded.nuget/build/MAUI.Native.Embedded.ios.widgets.targets +++ b/MAUI.Native.Embedded.nuget/build/MAUI.Native.Embedded.ios.widgets.targets @@ -40,7 +40,7 @@ - true + <_IsWidgets>true @@ -53,7 +53,7 @@ - + From 28075f013212a40595d25f84dafeb4c4065a3b47 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20L=C3=B8bger?= Date: Thu, 23 Oct 2025 09:47:44 +0200 Subject: [PATCH 15/15] Make UniqueId based on checksum This allows for faster rebuild as the temp folder name is the same every time --- .../build/MAUI.Native.Embedded.ios.common.targets | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/MAUI.Native.Embedded.nuget/build/MAUI.Native.Embedded.ios.common.targets b/MAUI.Native.Embedded.nuget/build/MAUI.Native.Embedded.ios.common.targets index 17591f8..ff13696 100644 --- a/MAUI.Native.Embedded.nuget/build/MAUI.Native.Embedded.ios.common.targets +++ b/MAUI.Native.Embedded.nuget/build/MAUI.Native.Embedded.ios.common.targets @@ -28,8 +28,16 @@ %(XcodeProjects.Filename) $(Configuration) $(XcodeParams) CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO CODE_SIGNING_ALLOWED=NO - $([System.Guid]::NewGuid()) + + + + + + + + + @@ -56,7 +64,7 @@ <_XcodeDestination Condition="$(TargetPlatformIdentifier) == 'ios'">iOS - <_XcodeDestination Condition="$(RuntimeIdentifier.Contains('iossimulator')) == true">iOS Simulator + <_XcodeDestination Condition="$(RuntimeIdentifier.Contains('simulator')) == true">$(_XcodeDestination) Simulator $(XCodeCommonParams) -destination 'generic/platform=$(_XcodeDestination)'