Skip to content

Commit 43d3e27

Browse files
committed
chore(demo): conditionally add iOS target on macOS only
1 parent 3d3e9e8 commit 43d3e27

2 files changed

Lines changed: 24 additions & 5 deletions

File tree

.github/workflows/e2e.yml

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,15 @@ jobs:
4545
with:
4646
dotnet-version: '10.0.x'
4747

48-
- name: Install MAUI Android workload
49-
run: dotnet workload install maui-android
48+
# Install both maui-android and maui-ios. The OneSignal library projects
49+
# are multi-targeted (net10.0;net10.0-android;net10.0-ios;netstandard2.0),
50+
# and NuGet restore walks every declared TargetFramework of transitively
51+
# referenced projects. Without the iOS workload pack on disk, restoring
52+
# the iOS TFM of OneSignalSDK.DotNet/iOS/iOS.Binding fails with NETSDK1178
53+
# even though we only build the android TFM. The actual iOS build never
54+
# runs here; we just need the workload pack present for restore.
55+
- name: Install MAUI workloads
56+
run: dotnet workload install maui-android maui-ios
5057

5158
- name: Create demo .env
5259
working-directory: examples/demo
@@ -103,8 +110,12 @@ jobs:
103110
with:
104111
dotnet-version: '10.0.x'
105112

106-
- name: Install MAUI iOS workload
107-
run: dotnet workload install maui-ios
113+
# See note in build-android job: both workloads are required even though
114+
# only the iOS TFM is built, because restore walks the multi-targeted
115+
# library projects and the android TFM follows references into the
116+
# android-only OneSignalSDK.DotNet.Android* projects.
117+
- name: Install MAUI workloads
118+
run: dotnet workload install maui-android maui-ios
108119

109120
- name: Create demo .env
110121
working-directory: examples/demo

examples/demo/demo.csproj

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
3-
<TargetFrameworks>net10.0-android;net10.0-ios</TargetFrameworks>
3+
<!--
4+
iOS targets only on macOS hosts. Linux/Windows CI runners (e.g. the
5+
Android build job) don't have the iOS workload installed, and NuGet
6+
restore evaluates every declared TargetFramework, which would otherwise
7+
pull in NotificationServiceExtension.csproj (net10.0-ios) and fail with
8+
NETSDK1178 looking for Microsoft.iOS.Sdk.
9+
-->
10+
<TargetFrameworks>net10.0-android</TargetFrameworks>
11+
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('OSX'))">$(TargetFrameworks);net10.0-ios</TargetFrameworks>
412
<OutputType>Exe</OutputType>
513
<RootNamespace>OneSignalDemo</RootNamespace>
614
<UseMaui>true</UseMaui>

0 commit comments

Comments
 (0)