Link Assemblies Task Failed

THIS IS THE ERROR :-

Severity Code Description Project File Line Suppression State
Error The "LinkAssemblies" task failed unexpectedly.
System.IO.FileNotFoundException: Could not load assembly 'App25, Version=0.0.0.0, Culture=neutral, PublicKeyToken='. Perhaps it doesn't exist in the Mono for Android profile?
File name: 'App25.dll'
at Java.Interop.Tools.Cecil.DirectoryAssemblyResolver.Resolve(AssemblyNameReference reference, ReaderParameters parameters)
at Java.Interop.Tools.Cecil.DirectoryAssemblyResolver.GetAssembly(String fileName)
at Xamarin.Android.Tasks.LinkAssemblies.Execute(DirectoryAssemblyResolver res)
at Xamarin.Android.Tasks.LinkAssemblies.Execute()
at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
at Microsoft.Build.BackEnd.TaskBuilder.d__26.MoveNext() App25

Answers

  • JarvanJarvan Member, Xamarin Team Xamurai

    Try the follows:

    1. Right click on the Android project, and select Properies in the menu.
    2. In the project properties, go to Application.
    3. Set the Compile using Android version: (Target Framework) to the latest installed platform.
    4. In the project properties, go to Android Manifest.
    5. Set the Minimum Android version to API level 19 or higher, and the Target Android version to the latest installed platform you chose in (3).

    Tutorial: https://docs.microsoft.com/en-us/xamarin/xamarin-forms/troubleshooting/questions/android-linkassemblies-error

  • smarthardik10smarthardik10 Member ✭✭

    no,unfortunately it didn't work.

  • JarvanJarvan Member, Xamarin Team Xamurai

    Have you tried to delete the files of bin and obj folder and then restart the project?

  • smarthardik10smarthardik10 Member ✭✭

    I did try as you said,but no success again.

  • BrendanZagaeskiBrendanZagaeski USForum Administrator, Xamarin Team Xamurai

    Error The "LinkAssemblies" task failed unexpectedly.
    System.IO.FileNotFoundException: Could not load assembly 'App25, Version=0.0.0.0, Culture=neutral, PublicKeyToken='. Perhaps it doesn't exist in the Mono for Android profile?
    File name: 'App25.dll'

    As a quick idea in case it might be helpful, usually when the name of the assembly ("App25" in this case) mentioned in this error is one of the projects in your solution, it means that the project (App25 in this case) did not build successfully, so to resolve this "Could not load assembly" error, you'll want to look for the other errors in the build output to find the reason why the App25 project did not build successfully. (It might be something as small as a missing ; at the end of a line in one of the .cs files in the App25 project, for example.)

    (As one more little side note, this misleading "Could not load assembly" error that happens during the "LinkAssemblies" task should no longer happen starting with the current Xamarin.Android 9.4 preview version. So in that version and above, only the "real" error from the App25 project should appear, making it easier to track down the cause of the problem.)

  • albertobolkalbertobolk Member

    Hi,
    I'm stumbling on the same issue.
    The build works fine in debug but fails in release with the same error message.
    Inspecting the build log for hints on other errors doesn't lead to anything, I just have a few warnings (they are the same in Debug mode). If I look in the bin/Release folder I can see the dll the LinkAssemblies fails to find.
    I found a thread on the Developer Community but the workaround mentioned (clean and restart VS2019) doesn't seem to be working in my case.

  • albertobolkalbertobolk Member

    The solution, in my case, has been to disable Code Analysis on Build in the Project Build settings

Sign In or Register to comment.