Skip to content

Commit 06ac0d4

Browse files
authored
Update out-of-support net8.0 MAUI targets to net9.0 (microsoft#26463)
### Description <!-- Describe your changes. --> .NET MAUI 8 is out of support. See here: https://dotnet.microsoft.com/en-us/platform/support/policy/maui We started seeing errors about this in the NuGet packaging pipeline. ``` ##[error]C:\Program Files\dotnet\sdk\9.0.306\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.EolTargetFrameworks.targets(38,5): Error NETSDK1202: The workload 'net8.0-ios' is out of support and will not receive security updates in the future. Please refer to https://aka.ms/maui-support-policy for more information about the support policy. ``` This change updates net8.0 mobile target framework monikers to net9.0. ### Motivation and Context <!-- - Why is this change required? What problem does it solve? - If it fixes an open issue, please link to the issue here. --> Fix packaging pipeline.
1 parent 002539f commit 06ac0d4

File tree

12 files changed

+84
-59
lines changed

12 files changed

+84
-59
lines changed

csharp/sample/InferenceSample/Microsoft.ML.OnnxRuntime.InferenceSample.Maui/Microsoft.ML.OnnxRuntime.InferenceSample.Maui.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFrameworks>net8.0-android;net8.0-ios;net8.0-maccatalyst</TargetFrameworks>
4+
<TargetFrameworks>net9.0-android;net9.0-ios;net9.0-maccatalyst</TargetFrameworks>
55
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net8.0-windows10.0.19041.0</TargetFrameworks>
66
<OutputType>Exe</OutputType>
77
<RootNamespace>Microsoft.ML.OnnxRuntime.InferenceSample.Maui</RootNamespace>

csharp/src/Microsoft.ML.OnnxRuntime/Microsoft.ML.OnnxRuntime.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@
1919
<PropertyGroup Condition="('$(OrtPackageId)' == 'Microsoft.ML.OnnxRuntime' OR
2020
'$(OrtPackageId)' == 'Microsoft.ML.OnnxRuntime.Azure') AND
2121
'$(IncludeMobileTargets)' == 'true'">
22-
<MobileTargets>net8.0-android;net8.0-ios;net8.0-maccatalyst</MobileTargets>
22+
<MobileTargets>net9.0-android;net9.0-ios;net9.0-maccatalyst</MobileTargets>
2323
</PropertyGroup>
2424

2525
<PropertyGroup Condition="'$(OrtPackageId)' == 'Microsoft.ML.OnnxRuntime.Training' AND
2626
'$(IncludeMobileTargets)' == 'true'">
27-
<MobileTargets>net8.0-android</MobileTargets>
27+
<MobileTargets>net9.0-android</MobileTargets>
2828
</PropertyGroup>
2929

3030
<PropertyGroup>
File renamed without changes.

csharp/test/Microsoft.ML.OnnxRuntime.Tests.BrowserStack.Android/README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
This project will run the Android MAUI tests on BrowserStack, which allows you to run automated tests on a variety of mobile devices.
33

44
## Context
5-
Microsoft.ML.OnnxRuntime.Tests.MAUI uses DeviceRunners.VisualRunners to allow running the unit tests (found in Microsoft.ML.OnnxRuntime.Tests.Common) across multiple devices. DeviceRunners.VisualRunners provides a simple UI with a button that will run the unit tests and a panel with the unit test results.
5+
Microsoft.ML.OnnxRuntime.Tests.MAUI uses DeviceRunners.VisualRunners to allow running the unit tests (found in Microsoft.ML.OnnxRuntime.Tests.Common) across multiple devices. DeviceRunners.VisualRunners provides a simple UI with a button that will run the unit tests and a panel with the unit test results.
66

77
In order to automate the process of running the unit tests across mobile devices, Appium is used for UI testing orchestration (it provides a way to interact with the UI), and BrowserStack automatically runs these Appium tests across different mobile devices.
88

9-
This project does not include the capability to start an Appium server locally or attach to a local emulator or device.
9+
This project does not include the capability to start an Appium server locally or attach to a local emulator or device.
1010

1111
## Build & run instructions
1212
### Requirements
@@ -22,8 +22,8 @@ This project does not include the capability to start an Appium server locally o
2222

2323
### Run instructions
2424
1. Build the Microsoft.ML.OnnxRuntime.Tests.MAUI project into a signed APK.
25-
1. Run the following: `dotnet publish -c Release -f net8.0-android` in the Microsoft.ML.OnnxRuntime.Tests.MAUI directory.
26-
2. Search for the APK files generated. They should be located in `bin\Release\net8.0-android\publish`.
25+
1. Run the following: `dotnet publish -c Release -f net9.0-android` in the Microsoft.ML.OnnxRuntime.Tests.MAUI directory.
26+
2. Search for the APK files generated. They should be located in `bin\Release\net9.0-android\publish`.
2727
3. If they're in a different location, edit the `browserstack.yml` file to target the path to the signed APK.
2828
2. Ensure you've set the BrowserStack credentials as environment variables.
2929
3. Run the following in the Microsoft.ML.OnnxRuntime.Tests.Android.BrowserStack directory: `dotnet test`
@@ -36,13 +36,13 @@ This project does not include the capability to start an Appium server locally o
3636
- [Integration guide](https://www.browserstack.com/docs/app-automate/appium/getting-started/c-sharp/nunit/integrate-your-tests#CLI)
3737

3838
### Troubleshooting
39-
- Issues building the MAUI app:
39+
- Issues building the MAUI app:
4040
- Make sure that the maui and maui-android workloads are installed correctly by running `dotnet workload list`
4141
- If you believe the issues are workload related, you can also try running `dotnet workload repair` (this has personally never worked for me)
42-
- Try running `dotnet clean`. However, this does not fully remove all the previous intermediaries. If you're still running into the errors, manually deleting the bin and obj folders can sometimes resolve them.
42+
- Try running `dotnet clean`. However, this does not fully remove all the previous intermediaries. If you're still running into the errors, manually deleting the bin and obj folders can sometimes resolve them.
4343
- After building the MAUI app, try installing on an emulator and clicking the "Run All" button to ensure that everything is working. (If you are missing the ONNXRuntime package, it will not show up as an error until you click "Run All".)
4444
- Running the MAUI app from Visual Studio will not replicate running it through BrowserStack. Instead, use `adb install [path to signed apk]` to install the app then use the emulator to launch the app.
4545
- Issues with the Android.BrowserStack test app: there is an Appium Doctor package on npm -- run `npm install @appium/doctor --location=global` then `appium-doctor --android` and follow the directed instructions. Some errors with Appium on Android will not appear until runtime.
4646
- Connection refused by Appium server: this can happen if you already have an Appium server running locally. If you do, stop the Appium server then try `dotnet test` again.
47-
- App is crashing on BrowserStack or it emits an error that it cannot run this APK file: make sure that you are passing in the correct signed APK from the publish folder.
47+
- App is crashing on BrowserStack or it emits an error that it cannot run this APK file: make sure that you are passing in the correct signed APK from the publish folder.
4848
- It appears that a test runs on CLI but a build is not launched on BrowserStack: this happens when the BrowserStack Test Adapter cannot find the browserstack.yml file (which has to be named "browserstack.yml" -- do not be tricked by BrowserStack's article on custom-named configuration files)

csharp/test/Microsoft.ML.OnnxRuntime.Tests.BrowserStack.Android/browserstack.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
app: ..\Microsoft.ML.OnnxRuntime.Tests.MAUI\bin\Release\net8.0-android\publish\ORT.CSharp.Tests.MAUI-Signed.apk
1+
app: ..\Microsoft.ML.OnnxRuntime.Tests.MAUI\bin\Release\net9.0-android\publish\ORT.CSharp.Tests.MAUI-Signed.apk
22
platforms:
33
- platformName: android
44
deviceName: Samsung Galaxy S22 Ultra

csharp/test/Microsoft.ML.OnnxRuntime.Tests.MAUI/Microsoft.ML.OnnxRuntime.Tests.MAUI.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
Disabling those targets until the issues are resolved. -->
1515
<!-- <TargetFrameworks>net8.0-android;net8.0-ios;net8.0-maccatalyst</TargetFrameworks> -->
1616

17-
<TargetFrameworks>net8.0-android</TargetFrameworks>
17+
<TargetFrameworks>net9.0-android</TargetFrameworks>
1818
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net8.0-windows10.0.19041.0</TargetFrameworks>
1919

2020
<!-- Note for MacCatalyst:

csharp/tools/MauiModelTester/MauiModelTester.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFrameworks>net8.0-ios;net8.0-android34.0</TargetFrameworks>
4+
<TargetFrameworks>net9.0-ios;net9.0-android35.0</TargetFrameworks>
55
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net8.0-windows10.0.19041.0</TargetFrameworks>
66
<OutputType>Exe</OutputType>
77
<RootNamespace>MauiModelTester</RootNamespace>

0 commit comments

Comments
 (0)