Forum Xamarin.iOS
We are excited to announce that the Xamarin Forums are moving to the new Microsoft Q&A experience. Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

We encourage you to head over to Microsoft Q&A for .NET for posting new questions and get involved today.

Could not link assemblies when compiling Xamarin.iOS

IuliaJecanIuliaJecan USMember ✭✭

Hello,

SOS - HELP - SOS

I'm stuck on this for 4 days now.

When compiling the iOS version of my projet I have this error :

/Users/iulia/Documents/Git2/XamarinWorking/Entractes/PCSA_Infirmiers.iOS/MTOUCH: Error MT2001: Could not link assemblies. Reason: Error while processing references of 'PCSA_InfirmiersiOS, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' (MT2001) (PCSA_Infirmiers.iOS)

I added the argument "-v -v -v -v" to see the logs of the build. Here are the errors :

Target _DetectDebugNetworkConfiguration:
      DebugIPAddresses: 
Target _CompileAppManifest:
    Directory "bin/iPhone/Debug/device-builds/iphone7.2-12.4/PCSA_InfirmiersiOS.app.dSYM" doesn't exist. Skipping.
Target _ParseExtraMtouchArgs:
      NoSymbolStrip Output: False
      NoDSymUtil Output: false
Target _CompileToNative:
    /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/bin/mtouch @/Users/iulia/Documents/Git2/XamarinWorking/Entractes/PCSA_Infirmiers.iOS/obj/iPhone/Debug/device-builds/iphone7.2-12.4/response-file.rsp -v -v -v -v "--gcc_flags=-ObjC -lc++ -lsqlite3 -lz" 
    MTOUCH : warning MT0136: Cannot find the assembly 'SQLite-net, Version=1.6.292.0, Culture=neutral, PublicKeyToken=null' referenced from '/Users/iulia/Documents/Project_Git/MccModelsLibrary/MccModelsLibrary/MccModelsLibrary/bin/Debug/MccModelsLibrary.dll'.
    MTOUCH : warning MT0136: Cannot find the assembly 'SQLite-net, Version=1.6.292.0, Culture=neutral, PublicKeyToken=null' referenced from '/Users/iulia/medicallxamarinlibrary/MedicallXamarinLibrary/bin/Debug/netstandard2.0/MedicallXamarinLibrary.dll'.
    MTOUCH : warning MT0136: Cannot find the assembly 'Google.Maps, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' referenced from '/Users/iulia/Documents/Git2/XamarinWorking/Entractes/packages/Xamarin.Forms.GoogleMaps.3.3.0/lib/Xamarin.iOS10/Xamarin.Forms.GoogleMaps.iOS.dll'.
    MTOUCH : error MT2001: Could not link assemblies. Reason: Error while processing references of 'PCSA_InfirmiersiOS, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'
    --- inner exception
    Mono.Linker.LoadException: Error while processing references of 'PCSA_InfirmiersiOS, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' ---> Mono.Cecil.AssemblyResolutionException: Failed to resolve assembly: 'SQLite-net, Version=1.6.292.0, Culture=neutral, PublicKeyToken=null' ---> Mono.Cecil.AssemblyResolutionException: Failed to resolve assembly: 'SQLite-net, Version=1.6.292.0, Culture=neutral, PublicKeyToken=null'
      at Mono.Cecil.BaseAssemblyResolver.Resolve (Mono.Cecil.AssemblyNameReference name, Mono.Cecil.ReaderParameters parameters) [0x000ff] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/external/mono/external/cecil/Mono.Cecil/BaseAssemblyResolver.cs:172 
      at Mono.Linker.AssemblyResolver.Resolve (Mono.Cecil.AssemblyNameReference name, Mono.Cecil.ReaderParameters parameters) [0x000b2] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/linker/Linker/AssemblyResolver.cs:123 
      at Mono.Linker.LinkContext.Resolve (Mono.Cecil.IMetadataScope scope) [0x00009] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/linker/Linker/LinkContext.cs:231 
       --- End of inner exception stack trace ---
      at Mono.Linker.LinkContext.Resolve (Mono.Cecil.IMetadataScope scope) [0x00033] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/linker/Linker/LinkContext.cs:239 
      at Mono.Linker.LinkContext.ResolveReferences (Mono.Cecil.AssemblyDefinition assembly) [0x00024] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/linker/Linker/LinkContext.cs:288 
      at Mono.Linker.Steps.LoadReferencesStep.ProcessReferences (Mono.Cecil.AssemblyDefinition assembly) [0x00029] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/linker/Linker.Steps/LoadReferencesStep.cs:52 
      at Mono.Linker.Steps.LoadReferencesStep.ProcessReferences (Mono.Cecil.AssemblyDefinition assembly) [0x00046] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/linker/Linker.Steps/LoadReferencesStep.cs:54 
       --- End of inner exception stack trace ---
      at Mono.Linker.Steps.LoadReferencesStep.ProcessReferences (Mono.Cecil.AssemblyDefinition assembly) [0x00053] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/linker/Linker.Steps/LoadReferencesStep.cs:56 
      at Mono.Linker.Steps.LoadReferencesStep.ProcessAssembly (Mono.Cecil.AssemblyDefinition assembly) [0x00001] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/linker/Linker.Steps/LoadReferencesStep.cs:42 
      at Mono.Linker.Steps.BaseStep.Process (Mono.Linker.LinkContext context) [0x0002e] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/linker/Linker.Steps/BaseStep.cs:61 
      at Mono.Linker.Pipeline.ProcessStep (Mono.Linker.LinkContext context, Mono.Linker.Steps.IStep step) [0x0000f] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/linker/Linker/Pipeline.cs:134 
      at Mono.Linker.Pipeline.Process (Mono.Linker.LinkContext context) [0x00011] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/linker/Linker/Pipeline.cs:126 
      at MonoTouch.Tuner.Linker.Process (MonoTouch.Tuner.LinkerOptions options, MonoTouch.Tuner.MonoTouchLinkContext& context, System.Collections.Generic.List`1[Mono.Cecil.AssemblyDefinition]& assemblies) [0x000e0] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/tools/mtouch/Tuning.cs:80 
    ---
    --- inner exception
    Mono.Cecil.AssemblyResolutionException: Failed to resolve assembly: 'SQLite-net, Version=1.6.292.0, Culture=neutral, PublicKeyToken=null' ---> Mono.Cecil.AssemblyResolutionException: Failed to resolve assembly: 'SQLite-net, Version=1.6.292.0, Culture=neutral, PublicKeyToken=null'
      at Mono.Cecil.BaseAssemblyResolver.Resolve (Mono.Cecil.AssemblyNameReference name, Mono.Cecil.ReaderParameters parameters) [0x000ff] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/external/mono/external/cecil/Mono.Cecil/BaseAssemblyResolver.cs:172 
      at Mono.Linker.AssemblyResolver.Resolve (Mono.Cecil.AssemblyNameReference name, Mono.Cecil.ReaderParameters parameters) [0x000b2] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/linker/Linker/AssemblyResolver.cs:123 
      at Mono.Linker.LinkContext.Resolve (Mono.Cecil.IMetadataScope scope) [0x00009] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/linker/Linker/LinkContext.cs:231 
      at Mono.Linker.LinkContext.Resolve (Mono.Cecil.IMetadataScope scope) [0x00033] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/linker/Linker/LinkContext.cs:239 
      at Mono.Linker.LinkContext.ResolveReferences (Mono.Cecil.AssemblyDefinition assembly) [0x00024] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/linker/Linker/LinkContext.cs:288 
      at Mono.Linker.Steps.LoadReferencesStep.ProcessReferences (Mono.Cecil.AssemblyDefinition assembly) [0x00029] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/linker/Linker.Steps/LoadReferencesStep.cs:52 
      at Mono.Linker.Steps.LoadReferencesStep.ProcessReferences (Mono.Cecil.AssemblyDefinition assembly) [0x00046] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/linker/Linker.Steps/LoadReferencesStep.cs:54 
    ---
    --- inner exception
    Mono.Cecil.AssemblyResolutionException: Failed to resolve assembly: 'SQLite-net, Version=1.6.292.0, Culture=neutral, PublicKeyToken=null'
      at Mono.Cecil.BaseAssemblyResolver.Resolve (Mono.Cecil.AssemblyNameReference name, Mono.Cecil.ReaderParameters parameters) [0x000ff] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/external/mono/external/cecil/Mono.Cecil/BaseAssemblyResolver.cs:172 
      at Mono.Linker.AssemblyResolver.Resolve (Mono.Cecil.AssemblyNameReference name, Mono.Cecil.ReaderParameters parameters) [0x000b2] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/linker/Linker/AssemblyResolver.cs:123 
      at Mono.Linker.LinkContext.Resolve (Mono.Cecil.IMetadataScope scope) [0x00009] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/linker/Linker/LinkContext.cs:231 
    ---
      at MonoTouch.Tuner.Linker.Process (MonoTouch.Tuner.LinkerOptions options, MonoTouch.Tuner.MonoTouchLinkContext& context, System.Collections.Generic.List`1[Mono.Cecil.AssemblyDefinition]& assemblies) [0x003bc] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/tools/mtouch/Tuning.cs:122 
      at Xamarin.Bundler.Target.LinkAssemblies (System.Collections.Generic.List`1[Mono.Cecil.AssemblyDefinition]& assemblies, System.String output_dir, System.Collections.Generic.IEnumerable`1[T] sharedCodeTargets) [0x00256] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/tools/mtouch/Target.cs:588 
      at Xamarin.Bundler.Target.ManagedLink () [0x00724] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/tools/mtouch/Target.cs:737 
      at Xamarin.Bundler.Target.ProcessAssemblies () [0x000c2] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/tools/mtouch/Target.cs:941 
      at Xamarin.Bundler.Application.ProcessAssemblies () [0x0002f] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/tools/mtouch/Application.cs:1486 
      at Xamarin.Bundler.Application.BuildManaged () [0x00001] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/tools/mtouch/Application.cs:902 
      at Xamarin.Bundler.Application+<>c.<BuildAll>b__147_1 (Xamarin.Bundler.Application v) [0x00000] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/tools/mtouch/Application.cs:850 
      at System.Collections.Generic.List`1[T].ForEach (System.Action`1[T] action) [0x0001e] in <ba70b91736bd40cb990a357097dba9c3>:0 
      at Xamarin.Bundler.Application.BuildAll () [0x00050] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/tools/mtouch/Application.cs:850 
      at Xamarin.Bundler.Driver.Main2 (System.String[] args) [0x004a5] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/tools/mtouch/mtouch.cs:1378 
      at Xamarin.Bundler.Driver.Main (System.String[] args) [0x00015] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/tools/mtouch/mtouch.cs:886 
Done building target "_CompileToNative" in project "PCSA_Infirmiers.iOS.csproj" -- FAILED.

Removing the SQLLite-net-pcl package from my referenced projects do not help cause I need them for my fonction.
Updated all the packages from all the projects to the latest stable version. Checked if all the packages are the same everywhere.

My base project contains references to 2 others project ( a iOS Xamarin library and a .netPortable library )

Thank in advanced,
Iulia

Best Answer

Answers

  • LandLuLandLu Member, Xamarin Team Xamurai

    If you are consuming PCL to develop Xamarin.Forms I think it's time to migrate to .Net Standard.
    And it looks mostly like an issue of linker behavior. Have you tried to set it to Don't Linker?
    Moreover, what's the version of Forms and the VS?

  • IuliaJecanIuliaJecan USMember ✭✭

    @LandLu Thank you for the answer.

    Can you please explain "migrating to .net standard"?

    I tried "Don't link", but nothing changes.

    I am using the last version of Forms ( 4.3.0.991211 ) and VS Mac ( 8.3.8 ). I updated my dev environnement last week.

  • IuliaJecanIuliaJecan USMember ✭✭

    @LandLu Thank you!!!

    Changing my library type from PCL to .Net Standard help.

    I have other errors, but at least I can compile now.

  • thaufeethaufee Member ✭✭

    I have referenced an Assembly "System.ServiceModel" in my Xamarin Forms project. This causes this issue. I removed this assembly and installed "System.ServiceModel.Security" and "System.ServiceModel.Http" from nuget package.

    This resolved my problem.

Sign In or Register to comment.