How to fix the issue for 'Foundation' and 'UIKit' could not be found in appcenter build?

999 Views Asked by At

I have added a reference for "Xamarin.ios" to my project and it is working fine locally. I have committed the code and made a build for it in appcenter but it is failing and showing me error as mentioned below.

/Users/runner/work/1/s/Project/ViewModels/OrderViewModel.cs(19,7): error CS0246: The type or namespace name 'Foundation' could not be found (are you missing a using directive or an assembly reference?) [/Users/runner/work/1/s/Project/Project.csproj]
/Users/runner/work/1/s/Project/ViewModels/OrderViewModel.cs(20,7): error CS0246: The type or namespace name 'UIKit' could not be found (are you missing a using directive or an assembly reference?) [/Users/runner/work/1/s/Project/Project.csproj]

Time Elapsed 00:00:08.79
##[error]Error: The process '/Library/Frameworks/Mono.framework/Versions/6_12_11/bin/msbuild' failed with exit code 1

I have also tried with various mono versions but it did not work for me. Can you please suggest me the solution for the same?

1

There are 1 best solutions below

0
On

Ensure that Xamarin.iOS has referenced in iOS project not shared prject, because netstandard project can't use any API specific to Xamarin.iOS .

Open your iOS csproj file to check if <Reference Include="Xamarin.iOS" /> exists there .

Refer to https://github.com/xamarin/xamarin-macios/issues/10191 .