0

I am trying to automate a build for Xamarin.iOS using AppCenter. I have got three projects 4 projects as part of this.

  1. TestProj (Xamarin Forms Core Project)
  2. TestProj.iOS
  3. Notification Service Extension project
  4. Share Service Extension project

When I build the project, appcenter fails to restore the nuget for the "Notification Service Extension" project. The error that I get is :

NotificationService.cs(2,7): error CS0246: The type or namespace name 'Com' could not be found (are you missing a using directive or an assembly reference?)

Note: Com is the "Com.OneSignal" nuget package.

The configuration for the project is as follows:

  • Project : TestProj.iOS.csproj
  • Configuration : Release
  • SDK version: Xamarin.iOS 13.2
  • Xcode version : 11.2.1
  • Build type : Device build
  • Build frequency : Manually choose when to run builds

Note: I have added all provisioning profiles and I also have Pre-build script added to the project which is automatically detected. Script has the code to restore nuget for the solution.

#!/usr/bin/env bash
find $APPCENTER_SOURCE_DIRECTORY -name '*.sln' -print0 | xargs -0 -n1 nuget restore -DisableParallelProcessing

I would appreciate if someone could help me with this

Libin Joseph
  • 7,070
  • 5
  • 29
  • 52
  • have you reviewed the logs to see why it fails to restore? – Jason Feb 04 '20 at 03:01
  • @Jason , Thanks for ur reply. I just managed to get it fixed. It was to do with nuget version inconsistency. Visually in Visual Studio it was showing the right version number, but in the csproj it was pointing to a wrong version, aligned the version number with other projects and its working now – Libin Joseph Feb 04 '20 at 03:33
  • You would better post your solution and accept it as answer , this is a common issue which will help more people :) – Lucas Zhang Feb 04 '20 at 03:39
  • @LucasZhang-MSFT : done :) – Libin Joseph Feb 04 '20 at 04:37

1 Answers1

0

There were two different issues with the automated build.

  1. The version number of the nuget in visual studio package folder(solution pane) was different from what was there in csproj file.
  2. The version number was also different from what I had in my ios and xamarin forms project.

I believe the reason why the app was building and working locally for me was because, I had the old package a while ago, and it was still existing in the packages folder in solution.

Libin Joseph
  • 7,070
  • 5
  • 29
  • 52