Build fail, error MT2101: Can't resolve the reference 'System.String[] System.String::Split(System.Char,System.StringSplitOptions)'

帅比萌擦擦* 提交于 2020-01-25 01:04:05

问题


failing when building on Azure DevOps (formerly VSTS) using the Microsoft Hosted MacOS agent, mac-os-10.14. Any ideas?

The difference in INSTALLED SOFTWARE IN Mac-Os14 and my mac OS is below: Hosted agent Mac-Os14:

VS for Mac: 8.4.0 Nuget: 4.7.0 Xcode Latest: 11.3 .NET Core SDK 1.0.1 1.0.4 1.1.10 1.1.11 1.1.12 1.1.13 1.1.4 1.1.5 1.1.7 1.1.8 1.1.9 2.0.0 2.0.3 2.1.100 2.1.101 2.1.102 2.1.103 2.1.104 2.1.105 2.1.2 2.1.200 2.1.201 2.1.202 2.1.300 2.1.301 2.1.302 2.1.4 2.1.400 2.1.401 2.1.402 2.1.403 2.1.500 2.1.502 2.1.503 2.1.504 2.1.505 2.2.100 2.2.101 2.2.102 2.2.103 2.2.104 2.2.105

My Mac:

VS for Mac: 8.4.1 Nuget: 5.3.0 Xcode Latest: 11.3.1 .NET Core SDK SDK: /usr/local/share/dotnet/sdk/3.1.100/Sdks SDK Versions: 3.1.100 3.0.101 3.0.100 2.1.701 2.1.700 2.1.505 2.1.504 2.1.302 MSBuild SDKs: /Library/Frameworks/Mono.framework/Versions/6.6.0/lib/mono/msbuild/Current/bin/Sdks

Environment for Visual Studio Mac

=== Visual Studio Community 2019 for Mac ===

Version 8.4.1 (build 4)
Installation UUID: 1b63757d-df76-44cf-be32-c4667c711155
    GTK+ 2.24.23 (Raleigh theme)
    Xamarin.Mac 5.16.1.25 (issue-7441-d16-3-vsmac / 881172e73)

    Package version: 606000155

=== Mono Framework MDK ===

Runtime:
    Mono 6.6.0.155 (2019-08/296a9afdb24) (64-bit)
    Package version: 606000155

=== Roslyn (Language Service) ===

3.4.0-beta4-19562-05+ff930dec4565e2bc424ad3bf3e22ecb20542c87d

=== NuGet ===

Version: 5.3.0.6192

=== .NET Core SDK ===

SDK: /usr/local/share/dotnet/sdk/3.1.100/Sdks
SDK Versions:
    3.1.100
    3.0.101
    3.0.100
    2.1.701
    2.1.700
    2.1.505
    2.1.504
    2.1.302
MSBuild SDKs: /Library/Frameworks/Mono.framework/Versions/6.6.0/lib/mono/msbuild/Current/bin/Sdks

=== .NET Core Runtime ===

Runtime: /usr/local/share/dotnet/dotnet
Runtime Versions:
    3.1.0
    3.0.1
    3.0.0
    2.1.14
    2.1.13
    2.1.12
    2.1.11
    2.1.9
    2.1.8
    2.1.2

=== Xamarin.Profiler ===

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

=== Updater ===

Version: 11

=== Apple Developer Tools ===

Xcode 11.3.1 (15715)
Build 11C504

=== Xamarin.Mac ===

Version: 6.10.0.17 (Visual Studio Community)
Hash: 5f802ef53
Branch: xcode11.3
Build date: 2020-01-07 11:53:06-0500

=== Xamarin.iOS ===

Version: 13.10.0.17 (Visual Studio Community)
Hash: 5f802ef53
Branch: xcode11.3
Build date: 2020-01-07 11:53:06-0500

=== Xamarin Designer ===

Version: 16.4.0.478
Hash: 95f0ab363
Branch: remotes/origin/d16-4
Build date: 2020-01-08 23:59:46 UTC

=== Xamarin.Android ===

Version: 10.1.3.7 (Visual Studio Community)
Commit: xamarin-android/d16-4/d66aed
Android SDK: /Users/name/Library/Developer/Xamarin/android-sdk-macosx
    Supported Android versions:
        None installed

SDK Tools Version: 26.1.1
SDK Platform Tools Version: 28.0.2
SDK Build Tools Version: 28.0.3

Build Information: 
Mono: fd9f379
Java.Interop: xamarin/java.interop/d16-4@c4e569f
ProGuard: xamarin/proguard/master@905836d
SQLite: xamarin/sqlite/3.28.0@46204c4
Xamarin.Android Tools: xamarin/xamarin-android-tools/master@9f4ed4b

=== Microsoft Mobile OpenJDK ===

Java SDK: /Users/name/Library/Developer/Xamarin/jdk/microsoft_dist_openjdk_1.8.0.25
1.8.0-25
Android Designer EPL code available here:
https://github.com/xamarin/AndroidDesigner.EPL

=== Android SDK Manager ===

Version: 16.4.0.9
Hash: 3f7256f
Branch: remotes/origin/d16-4
Build date: 2020-01-08 19:54:56 UTC

=== Android Device Manager ===

Version: 16.4.0.28
Hash: 68e9956
Branch: remotes/origin/d16-4
Build date: 2020-01-08 19:55:18 UTC

=== Xamarin Inspector ===

Version: 1.4.3
Hash: db27525
Branch: 1.4-release
Build date: Mon, 09 Jul 2018 21:20:18 GMT
Client compatibility: 1

=== Build Information ===

Release ID: 804010004
Git revision: 5f675128315bd5886b283aa192b334a02bc8a758
Build date: 2020-01-10 13:54:46+00
Build branch: release-8.4
Xamarin extensions: 6e5c119bf1e7b092680c1491be659f152329f74e

=== Operating System ===

Mac OS X 10.14.6
Darwin 18.7.0 Darwin Kernel Version 18.7.0
    Tue Aug 20 16:57:14 PDT 2019
    root:xnu-4903.271.2~2/RELEASE_X86_64 x86_64

回答1:


The default Mono version on hosted Macs is 5.12 which is most likely causing this issue. Adding a Bash script task to the beginning of the pipeline that executes the code below fixed the issue for me.

/bin/bash -c "sudo $AGENT_HOMEDIRECTORY/scripts/select-xamarin-sdk.sh Latest"

/bin/bash -c "echo '##vso[task.setvariable variable=MD_APPLE_SDK_ROOT;]'/Applications/Xcode_11.2.1.app;sudo xcode-select --switch /Applications/Xcode_11.2.1.app/Contents/Developer"

Hope that helps!



来源:https://stackoverflow.com/questions/59790523/build-fail-error-mt2101-cant-resolve-the-reference-system-string-system-st

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!