Forum Xamarin.iOS

Build error: MT2001: Could not link assemblies. Reason: Error while processing references

braderbrader USMember ✭✭

I'm receiving the following error while building my Xamarin Forms app for iOS:

...Xamarin.iOS.Common.targets(793,3): error MT2001: Could not link assemblies. Reason: Error while processing references of 'AppNameRedacted.iOS, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'

Confusing part to me is that this is Debug mode with linking disabled (though that might refer to the C# linking I guess).

This comes after updating the app to use .NET Standard 2.0 and updating Xamarin Forms from 2.3 to 3.1. I still have some nuget packages that are not .NET Standard referenced in some class libraries, not sure if that could be part of the issue. I'm running latest stable Visual Studio 2017 and Xamarin versions on PC/Mac.

Tagged:

Best Answer

Answers

  • UdaraAlwisUdaraAlwis LKMember ✭✭✭

    Thanks for posting the solution, I also came across the same issue at first when I updated to Xamarin.Forms 3.1 and resolved by following the steps you provided. :) Cheers!

  • mhdmaktabimhdmaktabi Member ✭✭

    I'm unable to compile my Xamarin.iOS project. This project was recently migrated from .NET Standard 1.4 to a .NET Standard 2 project in VS2017 on Windows connect to the Mac Agent.

    I'm getting this error:

    Error: Could not link assemblies. Reason: Error while processing references of 'Clients.iOS, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'

    This is part of the Build log:

    warning MSB3276: Found conflicts between different versions of the same dependent assembly. Please set the "AutoGenerateBindingRedirects" property to true in the project file.

    Consider app.config remapping of assembly "System.Runtime, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" from Version "4.0.0.0" to Version "4.0.20.0" [] to solve conflict and get rid of warning.rning.

    (1,1): error: Xamarin.FFImageLoading package not found for versions [2.2.20, ] on netstandard1.4

  • 15mgm1515mgm15 USMember ✭✭✭✭

    I am getting the same exact error after updating to the latest Xamarin.Forms version, adding -v -v -v -v to "Additional mtouch arguments" does not display any additional data, does anyone has a solution for this?

  • PaulDistonPaulDiston USUniversity ✭✭✭✭

    @15mgm15 Did you look in the Output window?

  • 15mgm1515mgm15 USMember ✭✭✭✭

    Hello @PaulDiston Yeah, I even delete all the NuGet packages on my iOS project except the Xamarin.Forms one and I am getting the same error :|

  • phung02phung02 USMember
    edited November 2018

    I got the same error as well, output windows shows:
    1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(795,3): error MT2001: Could not link assemblies. Reason: Error while processing references of 'VEYM.iOS, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'
    1> --- inner exception
    1> Mono.Linker.LoadException: Error while processing references of 'VEYM.iOS, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' ---> Mono.Linker.LoadException: Error while processing references of 'VEYM, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' ---> Mono.Cecil.AssemblyResolutionException: Failed to resolve assembly: 'Java.Interop, Version=0.1.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065' ---> Mono.Cecil.AssemblyResolutionException: Failed to resolve assembly: 'Java.Interop, Version=0.1.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065'
    1> at Mono.Cecil.BaseAssemblyResolver.Resolve (Mono.Cecil.AssemblyNameReference name, Mono.Cecil.ReaderParameters parameters) [0x00105] in :0
    1> at Mono.Linker.AssemblyResolver.Resolve (Mono.Cecil.AssemblyNameReference name, Mono.Cecil.ReaderParameters parameters) [0x00071] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/external/mono/external/linker/linker/Linker/AssemblyResolver.cs:80
    1> at Mono.Linker.LinkContext.Resolve (Mono.Cecil.IMetadataScope scope) [0x00009] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/external/mono/external/linker/linker/Linker/LinkContext.cs:210
    1> --- End of inner exception stack trace ---
    1> at Mono.Linker.LinkContext.Resolve (Mono.Cecil.IMetadataScope scope) [0x00046] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/external/mono/external/linker/linker/Linker/LinkContext.cs:220
    1> at Mono.Linker.LinkContext.ResolveReferences (Mono.Cecil.AssemblyDefinition assembly) [0x00024] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/external/mono/external/linker/linker/Linker/LinkContext.cs:254
    1> at Mono.Linker.Steps.LoadReferencesStep.ProcessReferences (Mono.Cecil.AssemblyDefinition assembly) [0x0002c] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/external/mono/external/linker/linker/Linker.Steps/LoadReferencesStep.cs:52
    1> at Mono.Linker.Steps.LoadReferencesStep.ProcessReferences (Mono.Cecil.AssemblyDefinition assembly) [0x00049] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/external/mono/external/linker/linker/Linker.Steps/LoadReferencesStep.cs:54
    1> --- End of inner exception stack trace ---
    1> at Mono.Linker.Steps.LoadReferencesStep.ProcessReferences (Mono.Cecil.AssemblyDefinition assembly) [0x00056] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/external/mono/external/linker/linker/Linker.Steps/LoadReferencesStep.cs:56
    1> at Mono.Linker.Steps.LoadReferencesStep.ProcessReferences (Mono.Cecil.AssemblyDefinition assembly) [0x00049] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/external/mono/external/linker/linker/Linker.Steps/LoadReferencesStep.cs:54
    1> --- End of inner exception stack trace ---
    1> at Mono.Linker.Steps.LoadReferencesStep.ProcessReferences (Mono.Cecil.AssemblyDefinition assembly) [0x00056] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/external/mono/external/linker/linker/Linker.Steps/LoadReferencesStep.cs:56
    1> at Mono.Linker.Steps.LoadReferencesStep.ProcessAssembly (Mono.Cecil.AssemblyDefinition assembly) [0x00001] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/external/mono/external/linker/linker/Linker.Steps/LoadReferencesStep.cs:42
    1> at Mono.Linker.Steps.BaseStep.Process (Mono.Linker.LinkContext context) [0x0002e] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/external/mono/external/linker/linker/Linker.Steps/BaseStep.cs:61
    1> at Mono.Linker.Pipeline.Process (Mono.Linker.LinkContext context) [0x0001f] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/external/mono/external/linker/linker/Linker/Pipeline.cs:127
    1> at MonoTouch.Tuner.Linker.Process (MonoTouch.Tuner.LinkerOptions options, MonoTouch.Tuner.MonoTouchLinkContext& context, System.Collections.Generic.List1[Mono.Cecil.AssemblyDefinition]& assemblies) [0x000e0] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/tools/mtouch/Tuning.cs:80 1> --- 1> --- inner exception 1> Mono.Linker.LoadException: Error while processing references of 'VEYM, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' ---> Mono.Cecil.AssemblyResolutionException: Failed to resolve assembly: 'Java.Interop, Version=0.1.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065' ---> Mono.Cecil.AssemblyResolutionException: Failed to resolve assembly: 'Java.Interop, Version=0.1.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065' 1> at Mono.Cecil.BaseAssemblyResolver.Resolve (Mono.Cecil.AssemblyNameReference name, Mono.Cecil.ReaderParameters parameters) [0x00105] in <c9b10aa46d12445c8cdc91721b44f98c>:0 1> at Mono.Linker.AssemblyResolver.Resolve (Mono.Cecil.AssemblyNameReference name, Mono.Cecil.ReaderParameters parameters) [0x00071] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/external/mono/external/linker/linker/Linker/AssemblyResolver.cs:80 1> at Mono.Linker.LinkContext.Resolve (Mono.Cecil.IMetadataScope scope) [0x00009] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/external/mono/external/linker/linker/Linker/LinkContext.cs:210 1> --- End of inner exception stack trace --- 1> at Mono.Linker.LinkContext.Resolve (Mono.Cecil.IMetadataScope scope) [0x00046] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/external/mono/external/linker/linker/Linker/LinkContext.cs:220 1> at Mono.Linker.LinkContext.ResolveReferences (Mono.Cecil.AssemblyDefinition assembly) [0x00024] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/external/mono/external/linker/linker/Linker/LinkContext.cs:254 1> at Mono.Linker.Steps.LoadReferencesStep.ProcessReferences (Mono.Cecil.AssemblyDefinition assembly) [0x0002c] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/external/mono/external/linker/linker/Linker.Steps/LoadReferencesStep.cs:52 1> at Mono.Linker.Steps.LoadReferencesStep.ProcessReferences (Mono.Cecil.AssemblyDefinition assembly) [0x00049] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/external/mono/external/linker/linker/Linker.Steps/LoadReferencesStep.cs:54 1> --- End of inner exception stack trace --- 1> at Mono.Linker.Steps.LoadReferencesStep.ProcessReferences (Mono.Cecil.AssemblyDefinition assembly) [0x00056] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/external/mono/external/linker/linker/Linker.Steps/LoadReferencesStep.cs:56 1> at Mono.Linker.Steps.LoadReferencesStep.ProcessReferences (Mono.Cecil.AssemblyDefinition assembly) [0x00049] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/external/mono/external/linker/linker/Linker.Steps/LoadReferencesStep.cs:54 1> --- 1> --- inner exception 1> Mono.Cecil.AssemblyResolutionException: Failed to resolve assembly: 'Java.Interop, Version=0.1.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065' ---> Mono.Cecil.AssemblyResolutionException: Failed to resolve assembly: 'Java.Interop, Version=0.1.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065' 1> at Mono.Cecil.BaseAssemblyResolver.Resolve (Mono.Cecil.AssemblyNameReference name, Mono.Cecil.ReaderParameters parameters) [0x00105] in <c9b10aa46d12445c8cdc91721b44f98c>:0 1> at Mono.Linker.AssemblyResolver.Resolve (Mono.Cecil.AssemblyNameReference name, Mono.Cecil.ReaderParameters parameters) [0x00071] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/external/mono/external/linker/linker/Linker/AssemblyResolver.cs:80 1> at Mono.Linker.LinkContext.Resolve (Mono.Cecil.IMetadataScope scope) [0x00009] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/external/mono/external/linker/linker/Linker/LinkContext.cs:210 1> at Mono.Linker.LinkContext.Resolve (Mono.Cecil.IMetadataScope scope) [0x00046] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/external/mono/external/linker/linker/Linker/LinkContext.cs:220 1> at Mono.Linker.LinkContext.ResolveReferences (Mono.Cecil.AssemblyDefinition assembly) [0x00024] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/external/mono/external/linker/linker/Linker/LinkContext.cs:254 1> at Mono.Linker.Steps.LoadReferencesStep.ProcessReferences (Mono.Cecil.AssemblyDefinition assembly) [0x0002c] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/external/mono/external/linker/linker/Linker.Steps/LoadReferencesStep.cs:52 1> at Mono.Linker.Steps.LoadReferencesStep.ProcessReferences (Mono.Cecil.AssemblyDefinition assembly) [0x00049] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/external/mono/external/linker/linker/Linker.Steps/LoadReferencesStep.cs:54 1> --- 1> --- inner exception 1> Mono.Cecil.AssemblyResolutionException: Failed to resolve assembly: 'Java.Interop, Version=0.1.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065' 1> at Mono.Cecil.BaseAssemblyResolver.Resolve (Mono.Cecil.AssemblyNameReference name, Mono.Cecil.ReaderParameters parameters) [0x00105] in <c9b10aa46d12445c8cdc91721b44f98c>:0 1> at Mono.Linker.AssemblyResolver.Resolve (Mono.Cecil.AssemblyNameReference name, Mono.Cecil.ReaderParameters parameters) [0x00071] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/external/mono/external/linker/linker/Linker/AssemblyResolver.cs:80 1> at Mono.Linker.LinkContext.Resolve (Mono.Cecil.IMetadataScope scope) [0x00009] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/external/mono/external/linker/linker/Linker/LinkContext.cs:210 1> --- 1> at MonoTouch.Tuner.Linker.Process (MonoTouch.Tuner.LinkerOptions options, MonoTouch.Tuner.MonoTouchLinkContext& context, System.Collections.Generic.List1[Mono.Cecil.AssemblyDefinition]& assemblies) [0x003ad] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/tools/mtouch/Tuning.cs:122
    1> at Xamarin.Bundler.Target.LinkAssemblies (System.Collections.Generic.List1[Mono.Cecil.AssemblyDefinition]& assemblies, System.String output_dir, System.Collections.Generic.IEnumerable1[T] sharedCodeTargets) [0x00256] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/tools/mtouch/Target.cs:517
    1> at Xamarin.Bundler.Target.ManagedLink () [0x00720] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/tools/mtouch/Target.cs:664
    1> at Xamarin.Bundler.Target.ProcessAssemblies () [0x000c2] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/tools/mtouch/Target.cs:868
    1> at Xamarin.Bundler.Application.ProcessAssemblies () [0x0002f] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/tools/mtouch/Application.cs:1411
    1> at Xamarin.Bundler.Application.BuildManaged () [0x00001] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/tools/mtouch/Application.cs:839
    1> at Xamarin.Bundler.Application+<>c.b__140_1 (Xamarin.Bundler.Application v) [0x00000] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/tools/mtouch/Application.cs:787
    1> at System.Collections.Generic.List1[T].ForEach (System.Action1[T] action) [0x00024] in <71f4e3d7d65e42b0a699d02e59766d3c>:0
    1> at Xamarin.Bundler.Application.BuildAll () [0x00050] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/tools/mtouch/Application.cs:787
    1> at Xamarin.Bundler.Driver.Main2 (System.String[] args) [0x00423] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/tools/mtouch/mtouch.cs:1402
    1> at Xamarin.Bundler.Driver.Main (System.String[] args) [0x00015] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/tools/mtouch/mtouch.cs:934
    ========== Build: 0 succeeded, 1 failed, 1 up-to-date, 0 skipped ==========
    ========== Deploy: 0 succeeded, 0 failed, 0 skipped ==========

  • phung02phung02 USMember

    I got the same error and i seems like this code is causing the issue "Build.Serial". I was trying to get the android device serial number by calling Build.Serial, but it seems like to caused iOS project to fail with error "Error: Could not link assemblies. Reason: Error while processing references of 'Clients.iOS, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'"

  • BuildCalcBuildCalc USMember ✭✭✭

    I lost a day chasing this issue so I am documenting here in case someone else struggles with this issue as much as I did. My apologies for there not being more detail. I was getting this issue when trying make a Release | iPhone build for a Xamarin.Forms iOS app. The Android and UWP versions built without issue. Based upon what I read elsewhere, I tried the following:

    • Did a Build / Clean All
    • Deleted all of the bin and obj folders and restarted VisualStudio
    • Looked at the "verbose" and "detailed" build logs. Here is where things deviated from above. There was a stack trace for the build but there was no details to suggest what reference in my build configuration triggered it.
    • Converted all of NuGet references (in the iOS project) from using packages.config to using the <PackageReference> tag in the iOS platform project's csproj file. This included removing all of the <Reference> tags to each packages dlls.

    Ultimately, what I discovered is one of the NuGet packages had put an app.config file in my iOS project directory (it did this in all of this solution's iOS platform projects that referenced it). These app.config files worked fine until I upgraded the package in question. It appears that the upgrade no longer used app.config bug it didn't remove it. Since the remnant app.config was referencing different versions of the NuGet packages dependencies than the updated version, it was causing conflicting NuGet dependencies in the same project.

  • HalilDoganBolakHalilDoganBolak USMember ✭✭

    @BuildCalc Thank you. I had the exact same problem. By the way that NuGet package is Xamarin.Forms if anyone is interested to know. Yes Xamarin.Forms.

  • ChdoulaChdoula JPMember ✭✭

    maybe because you are referencing Mono.android dll in iOS project

  • VieGarcianoVieGarciano Member ✭✭

    Hi everyone! Any solution for this? :/

  • VieGarcianoVieGarciano Member ✭✭

    @UdaraAlwis said:
    Thanks for posting the solution, I also came across the same issue at first when I updated to Xamarin.Forms 3.1 and resolved by following the steps you provided. :) Cheers!

    Which steps? Can you elaborate? :smile:

  • VieGarcianoVieGarciano Member ✭✭

    @BuildCalc said:
    I lost a day chasing this issue so I am documenting here in case someone else struggles with this issue as much as I did. My apologies for there not being more detail. I was getting this issue when trying make a Release | iPhone build for a Xamarin.Forms iOS app. The Android and UWP versions built without issue. Based upon what I read elsewhere, I tried the following:

    • Did a Build / Clean All
    • Deleted all of the bin and obj folders and restarted VisualStudio
    • Looked at the "verbose" and "detailed" build logs. Here is where things deviated from above. There was a stack trace for the build but there was no details to suggest what reference in my build configuration triggered it.
    • Converted all of NuGet references (in the iOS project) from using packages.config to using the <PackageReference> tag in the iOS platform project's csproj file. This included removing all of the <Reference> tags to each packages dlls.

    Ultimately, what I discovered is one of the NuGet packages had put an app.config file in my iOS project directory (it did this in all of this solution's iOS platform projects that referenced it). These app.config files worked fine until I upgraded the package in question. It appears that the upgrade no longer used app.config bug it didn't remove it. Since the remnant app.config was referencing different versions of the NuGet packages dependencies than the updated version, it was causing conflicting NuGet dependencies in the same project.

    is it okay to manually remove the app config file inside iOS project directory? Already tried Build/Clean All and deleting bin an obj folder but still I'm getting this error.

  • kingkanekingkane Member ✭✭

    What error are you getting?

    This here:
    Failed to resolve assembly: 'Java.Interop, Version=0.1.0.0, means that Mono.android is being referenced in the PCL project.

  • jariwalahetaljariwalahetal USMember ✭✭

    adding additional arguments worked for me there were two dlls missing from reference

  • Hi Everyone,
    I too facing same issue while build ios application. anyone please help me resolve this issue...

  • VieGarcianoVieGarciano Member ✭✭

    Hi all! Maybe my solution will solve your problem too. What caused my error was there are nuget packages that are automatically updated and changed names just like packages containing names HotTuna and Cirrious. Please refer to this link to read the documentation. My preferences looked like this (I already deleted packages with names Cirrious) before removing them in csproj. refer to the photo below:

    What I did I unload the project and then manually removed the packages. After, I clean the solution and rebuild it. When you checked the references portion, the packages that caused the error are now gone. Try to run it again. In my case, it solved my problem and now I can successfully run it to an iphone simulator :smile:

    Please make sure that before running the app, all packages are updated/normal condition. I hope this will help you :smile:

  • JuanTopoJuanTopo USMember

    I make it work thanks to this post and half of the internet :). Hope it helps someone. It wasted 2 days trying to solve this issue.
    What I figured out was that in the file "[yourProyect].csproj" located in the root of our solution (the base file, not the IOS one) was a reference to "Mono.Android" that seems to make the IOS build crash.

    I simply remove it, Rebuild All, and go. Magic.

    The Reference that I remove from the ".csproj" file was:

    <ItemGroup>
        <Reference Include="Mono.Android">
          <HintPath>..\..\..\..\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\ReferenceAssemblies\Microsoft\Framework\MonoAndroid\v8.1\Mono.Android.dll</HintPath>
        </Reference>
      </ItemGroup>
    
Sign In or Register to comment.