i have a net8 maui app with the following target frameworks:
<TargetFrameworks>net8.0-android;net8.0-ios;</TargetFrameworks>
i'm able to build, deploy and run on my physical device locally, however when i try to build the app inside an azure devops pipeline, the restore fails telling me
[error]The nuget command failed with exit code(1) and error(NU1202: Package Microsoft.Maui.Controls.Compatibility 8.0.72 is not compatible with net80-android (.NETFramework,Version=v8.0,Profile=android). Package Microsoft.Maui.Controls.Compatibility 8.0.72 supports:
this is not the only error i have. In particular i have some similar errors both on android and ios:
NU1202: Package Microsoft.Maui.Controls.Compatibility 8.0.72 is not compatible with net80-ios (.NETFramework,Version=v8.0,Profile=ios). Package Microsoft.Maui.Controls.Compatibility 8.0.72 supports:
i don't want to modify my code targeting a different set of TFWs, because for example the same pipeline on a github actions seems to work.
Even if the only way would be to change TFWs there are some mismatches on the ios version, like the example below:
NU1202: Package CommunityToolkit.Maui 9.0.3 is not compatible with net80-ios (.NETFramework,Version=v8.0,Profile=ios). Package CommunityToolkit.Maui 9.0.3 supports:
NU1202: Package Microsoft.Maui.Controls.Compatibility 8.0.72 is not compatible with net80-ios (.NETFramework,Version=v8.0,Profile=ios). Package Microsoft.Maui.Controls.Compatibility 8.0.72 supports:
here i see than CommunityToolkit.Maui 9.0.3 is compatible with net8.0-ios17.5 and Microsoft.Maui.Controls.Compatibility with net8.0-ios17.2.
i've tried to update the maui version to the latest stable 8.0.82 but the same issues appear.
here is my pipeline for ios:
trigger:
- develop
pool:
vmImage: macos-14
variables:
- group: Maui
steps:
- task: Bash@3
displayName: Install MAUI
inputs:
targetType: 'inline'
script: |
dotnet nuget locals all --clear
dotnet workload install maui-android maui-ios
- task: InstallAppleCertificate@2
inputs:
certSecureFile: 'bestshifts.p12'
certPwd: $(p12Secret)
keychain: 'temp'
- task: InstallAppleProvisioningProfile@1
inputs:
provisioningProfileLocation: 'secureFiles'
provProfileSecureFile: 'bestishifts-appstore.mobileprovision'
- task: NuGetCommand@2
displayName: 'Add custom NuGet source'
inputs:
command: 'custom'
arguments: 'sources add -name DevExpress -source https://nuget.devexpress.com/$(devExpressApiKey)/api'
- task: NuGetCommand@2
displayName: 'Restore NuGet packages'
inputs:
command: 'restore'
feedsToUse: 'select'
vstsFeed: 'https://nuget.devexpress.com/$(devExpressApiKey)/api'
includeNuGetOrg: true
- task: Bash@3
displayName: 'Build iOS App'
inputs:
targetType: 'inline'
script: |
dotnet build -f net8.0-ios -c Release -p:ArchiveOnBuild=true -p:RuntimeIdentifier=ios-arm64 -p:CodesignKey="iPhone Distribution" -p:CodesignProvision="Automatic" -o ./artifacts
I can reproduce the same error with your yaml.
You cannot use https://nuget.devexpress.com/$(devExpressApiKey)/api
as the vstsFeed
in Restore NuGet packages
, the parameter need to be the devops feed.
You can use dotnet restore with source to restore(link here):
dotnet restore your.sln --source "https://nuget.devexpress.com/$(devExpressApiKey)/api" --source "https://api.nuget.org/v3/index.json
sample yaml:
- task: UseDotNet@2 # add dotnet task
displayName: 'Use dotnet'
inputs:
packageType: 'sdk'
version: '$(sdkversion)'
- task: Bash@3
displayName: Install MAUI
inputs:
targetType: 'inline'
script: |
dotnet nuget locals all --clear
dotnet workload install maui-android maui-ios
- task: InstallAppleCertificate@2
inputs:
certSecureFile: 'bestshifts.p12'
certPwd: $(p12Secret)
keychain: 'temp'
- task: InstallAppleProvisioningProfile@1
inputs:
provisioningProfileLocation: 'secureFiles'
provProfileSecureFile: 'bestishifts-appstore.mobileprovision'
- task: Bash@3
displayName: 'restore nuget source'
inputs:
targetType: 'inline'
script: |
dotnet restore MauiSample.sln --source "https://nuget.devexpress.com/$(devExpressApiKey)/api" --source "https://api.nuget.org/v3/index.json"
- task: Bash@3
displayName: 'Build iOS App'
inputs:
targetType: 'inline'
script: |
dotnet build -f net8.0-ios -c Release -p:ArchiveOnBuild=true -p:RuntimeIdentifier=ios-arm64 -p:CodesignKey="iPhone Distribution" -p:CodesignProvision="Automatic" -o ./artifacts