Jop Middelkamp
Jop Middelkamp

Reputation: 153

.NET Standard 2.0 Xamarin.iOS project VSTS build issue

Currently I'm trying to upgrade a Xamarin.Forms project to use .NET Standard 2.0. This went fine for Android but I'm getting stuck with the iOS version. To build iOS we use a On-Primise MacMini as build agent int VSTS. Now I'm getting the error below when building the solution.

=================================

.... way more erros like below ...

2017-11-21T11:39:43.8920830Z ViewModels/DashboardViewModel.cs(66,35): error CS0012: The type 'Object' is defined in an assembly that is not referenced. You must add a reference to assembly 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. [/Users/Admin/BuildAgent/_work/3/s/xxx.App/xxx.Core.csproj] 2017-11-21T11:39:43.9014700Z ViewModels/DashboardViewModel.cs(66,73): error CS0012: The type 'Object' is defined in an assembly that is not referenced. You must add a reference to assembly 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. [/Users/Admin/BuildAgent/_work/3/s/xxx.App/xxx.Core.csproj] 2017-11-21T11:39:43.9036150Z ViewModels/DashboardViewModel.cs(66,93): error CS0012: The type 'Object' is defined in an assembly that is not referenced. You must add a reference to assembly 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. [/Users/Admin/BuildAgent/_work/3/s/xxx.App/xxx.Core.csproj] 2017-11-21T11:39:43.9053280Z 2017-11-21T11:39:43.9083060Z 6 Warning(s) 2017-11-21T11:39:43.9107960Z 47 Error(s) 2017-11-21T11:39:43.9116100Z 2017-11-21T11:39:43.9131830Z Time Elapsed 00:00:59.23 2017-11-21T11:39:43.9327960Z ##[error]Xamarin.iOS task failed with error Error: /Library/Frameworks/Mono.framework/Versions/Current/Commands/msbuild failed with return code: 1. For guidance on setting up the build definition, see https://go.microsoft.com/fwlink/?LinkId=760847. 2017-11-21T11:39:43.9575950Z [command]/usr/bin/security delete-keychain /Users/Admin/BuildAgent/_work/3/s/_xamariniostasktmp.keychain 2017-11-21T11:39:44.2658340Z ##[section]Finishing: Build Xamarin.iOS solution xxx.sln

=================================

This output comes from the following build definition:

CI Builddefinition

Now I've searched the internet and found a view possible solutions:

But all of this was not enough to fix the issue. Now I'm not a expert in using a Mac. Actually I never touched one before this issue... So I might have done something wrong here...

But I've been able to get some version information about all products on the MacMini:

========= Visual Studio =========

Visual Studio Community 2017 for Mac Version 7.2.2 (build 11) Installation UUID: b43353ef-651c-468b-8b7d-3f1714586419 Runtime: Mono 5.4.1.6 (2017-06/1f4613aa1ac) (64-bit) GTK+ 2.24.23 (Raleigh theme)

Package version: 504010006

NuGet Version: 4.3.1.4445

.NET Core Runtime: /usr/local/share/dotnet/dotnet Runtime Version: 2.0.3 SDK: /usr/local/share/dotnet/sdk/2.0.3/Sdks SDK Version: 2.0.3 MSBuild SDKs: /Library/Frameworks/Mono.framework/Versions/5.4.1/lib/mono/msbuild/15.0/bin/Sdks

Xamarin.Profiler Version: 1.5.6 Location: /Applications/Xamarin Profiler.app/Contents/MacOS/Xamarin Profiler

Xamarin.Android Not Installed

Xamarin Inspector Not Installed

Apple Developer Tools Xcode 9.1 (13532) Build 9B55

Xamarin.iOS Version: 11.3.0.47 (Visual Studio Community) Hash: 51128b8c Branch: xcode9.1 Build date: 2017-10-31 22:42:13-0400

Xamarin.Mac Xamarin.Mac not installed. Can't find /Library/Frameworks/Xamarin.Mac.framework/Versions/Current/Version.

Build Information Release ID: 702020011 Git revision: b604c37c5a4a2f0919b45ffbe2aaad9fe040af31 Build date: 2017-11-01 08:31:43-04 Xamarin addins: d57dc14cbd4eb166ee62bab585965ab78d3650bc Build lane: monodevelop-lion-d15-4

Operating System Mac OS X 10.12.6 Darwin 16.7.0 Darwin Kernel Version 16.7.0 Wed Oct 4 00:17:00 PDT 2017 root:xnu-3789.71.6~1/RELEASE_X86_64 x86_64

============= XCode =============

XCode for Mac Version 9.1 (9B55)

============= Mono ==============

Mono JIT compiler version 5.4.1.6 (2017-06/1f4613aa1ac Wed Oct 18 09:31:57 EDT 2017) Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com TLS: normal SIGSEGV: altstack Notification: kqueue Architecture: amd64 Disabled: none Misc: softdebug LLVM: yes(3.6.0svn-mono-master/8b1520c8aae) GC: sgen (concurrent by default)

========= .NET Core SDK =========

.NET Core SDK Version 2.0.3

=================================

The project can be build on the MacMini itself. Only the VSTS task keeps failing...

Does someone have any idea's left which can help me solve my issue?

Kind regards, Jop

Upvotes: 0

Views: 1836

Answers (1)

Jop Middelkamp
Jop Middelkamp

Reputation: 153

Everything started to work fine after we manually edited the .NET Standard 2.0 project file (*.csproj) and add a PackageReference by hand.

<ItemGroup>
  ...
  <PackageReference Include="NETStandard.Library" version="2.0.0" />
  ...
</ItemGroup>

Upvotes: 4

Related Questions