Maui not building in Azure pipeline
Description
We are building a MAUI app migrated from Xamarin. The application builds and runs smoothly on a local mac machine, but when I moved it to Azure pipeline to build, it is failing with below error.
error CS0246: The type or namespace name 'MauiTextField' could not be found (are you missing a using directive or an assembly reference?) [/Users/runner/work/1/s/TestMobile/DashMobile.csproj::TargetFramework=net8.0-ios] /Users/runner/work/1/s/TestMobile/Controls/Handlers/DoneEntryHandler.iOS.cs(37,35):
The maui handler code for the above error is as below.
using CoreGraphics;
using Microsoft.Maui.Handlers;
using Microsoft.Maui.Platform;
using UIKit;
namespace TestMobile.Controls.Handlers
{
public class DoneEntryHandler : EntryHandler
{
protected override void ConnectHandler(MauiTextField platformView)
{
base.ConnectHandler(PlatformView);
// handler code
}
}
}
Steps to Reproduce
The Azure build task is
steps:
- task: DotNetCoreCLI@2
displayName: 'dotnet build'
inputs:
projects: iOS/DashMobile.iOS.csproj
arguments: '--framework net8.0-ios --configuration:Release --verbosity d'
Link to public reproduction project repository
No response
Version with bug
8.0.3 GA
Is this a regression from previous behavior?
No, this is something new
Last version that worked well
Unknown/Other
Affected platforms
iOS
Affected platform versions
.Net SDK Version: 8.0.302
Did you find any workaround?
No response
Relevant log output
No response
Hi I'm an AI powered bot that finds similar issues based off the issue title.
Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one and thumbs upping the other issue to help us prioritize it. Thank you!
Closed similar issues:
- error CS0234: The type or namespace name 'iOS' does not exist in the namespace 'Microsoft.Maui.Controls.Compatibility.Platform' (#20589), similarity score: 0.81
- Error CS0246: The type or namespace name 'MauiUIApplicationDelegate' could not be found (are you missing a using directive or an assembly reference?) (CS0246) (#20649), similarity score: 0.79
- Error CS0246: The type or namespace name 'MauiUIApplicationDelegate' could not be found (are you missing a using directive or an assembly reference?) (#20638), similarity score: 0.78
- Another - Error CS0246: The type or namespace name 'MauiUIApplicationDelegate' could not be found (are you missing a using directive or an assembly reference?) (CS0246) (#21751), similarity score: 0.77
- [iOS] MAUI project won't build with the 8.0.0-rc.2.9530 version on Azure Pipeline (#18632), similarity score: 0.77
Note: You can give me feedback by thumbs upping or thumbs downing this comment.
Is the MAUI workload provisioned on the bots you're building on?
Can you build a template MAUI project in your Azure Pipelines?
I resolved it by using .NET SDK version 8.0.101.
The latest mac agent has these version of sdk: 7.0.102, 7.0.202, 7.0.306, 7.0.410, 8.0.101, 8.0.204, 8.0.302 So it tries to use the latest one 8.0.302 which has this problem. It also do not work on 8.0.204
Please fix it in latest sdks.