0

In my PCL project, I have used the dynamic initialization of objects code. So for xamarin linking process I have used the LinkerSafe attribute and Preserve attribute (added these attribute classes in my source as we don't have xamarin dependency).

I have generated the assembly from my PCL project MSBuild.exe command line in xamarin installed machine, which has no issues in the linking process. Assembly generated in the machine without xamarin tools throws an error on the linking process.

My question is whether we need xamarin tools installed for proper linker processed assembly?

Federico Navarrete
  • 3,069
  • 5
  • 41
  • 76
  • What is the Linker failure? Please post a full diagnostic build output from msbuild. – Jon Douglas Jan 04 '18 at 17:28
  • Linker failure means, while I deploying my Xamarin application with this PCL assembly in Android device with Link All behavior, type load initialization exception throws on dynamically initializing the objects (i.e. the preserve attribute added constructor has been removed in this linking process which implies that the proper linking is not done). But in assembly generated from xamarin installed machine working fine. I will post the diagnostic build output from msbuild..Thank you.. – Mathu Mohan Jan 05 '18 at 04:14
  • Your best bet would be creating a [Custom Linker Configuration](https://developer.xamarin.com/guides/cross-platform/advanced/custom_linking/) – Jon Douglas Jan 05 '18 at 17:07

1 Answers1

0

This depends on the platform as both Android and iOS have a LinkAssemblies equivalent task that runs the Mono Linker and is executed at build time. Those tasks are invoked by Android and iOS projects that include the respective targets.

There is an announcement of a .NET IL Linker based on the Mono Linker as well:

https://github.com/dotnet/announcements/issues/30 / https://github.com/dotnet/core/blob/master/samples/linker-instructions.md

It would be worth investigating your build via MSBuild Log Viewer and binlog:

http://msbuildlog.com/

Jon Douglas
  • 13,006
  • 4
  • 38
  • 51