Forum Xamarin.Android

Build Error Linking with Net Standard library

I have a project structure as follows

< Library A> - A Net Standard library which has a dependency on YamlDotNet nuget Package. < Library A> is packaged as a nuget package.

< Library B> - A Xamarin Android Class Library (net Framework ??) This depends on < library A> as a nuget package

< App> - A Xamarin Android App that references < library B> (within the same visual studio solution)

This all successfully builds within Visual Studio and with Cake Scripts calling MSBuild outside of Visual Stdio. My problem is on my build server I am getting this error

build   14-Nov-2019 21:39:34      C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(2129,5): error MSB4018: The "LinkAssemblies" task failed unexpectedly.  ... [<../App/App.csproj>]
build   14-Nov-2019 21:39:34    C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(2129,5): error MSB4018: Mono.Linker.MarkException: Error processing method: 'YamlDotNet.Serialization.IPropertyDescriptor YamlDotNet.Serialization.ITypeInspector::GetProperty(System.Type,System.Object,System.String,System.Boolean)' in assembly: 'YamlDotNet.dll' ---> Mono.Cecil.ResolutionException: Failed to resolve System.Void System.Diagnostics.CodeAnalysis.MaybeNullWhenAttribute::.ctor(System.Boolean) [<../App/App.csproj>]

I think this is the same error that was reported here < github DOT com/mono/mono/issues/17064 > (reported as an iOS error but i think it is relevant for Android) This was fixed with < github DOT com/xamarin/xamarin-android/commit/5e714bfb1b5a35c3722eefefdd789d69cb307ae3 >

On my machine I have Visual Studio 2017 Professional 15.9.11. This has Xamarin version 4.12.3.83 and Xamarin.Android SDK version 9.1.7.0

However, on the Build server we are just running Microsoft Build tools. I am a little confused as to what version is being run on the server and I cant work out what is different. The one thing I have found is the Xamarin Android SDK appears to be the same
contents of "Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\Xamarin\Android\Version.txt" is 9.1.7

Questions
1) Is my build error the same as the one I linked?
2) What component has the fix for that error, What version of that do I need?
3) Why am i getting different results on my machine vs the build server, Is something a different version with the bug?

Thanks

P.s. I have very little experience with Xamarin, .Net, and Windows development in general. Still trying to get my head around everything!

Sign In or Register to comment.