c# – Xamarin Android Build Failed "Invalid value for outputAssembly"-ThrowExceptions

Exception or error:

A few days ago my solution seemed to work fine, but today all of the sudden the Android project doesn’t build.
I get no Error, but I do get the following output:

1>Build started.
1>Project "MyApp.Android.csproj" (Install target(s)):
1>Project "MyApp.csproj" (GetTargetFrameworks target(s)):
1>Done building project "MyApp.csproj".
1>Project "MyApp.csproj" (GetTargetFrameworks target(s)):
1>Done building project "MyApp.csproj".
1>Project "MyApp.csproj" (GetTargetPath target(s)):
1>Done building project "MyApp.csproj".
1>Project "MyApp.csproj" (GetTargetPath target(s)):
1>Done building project "MyApp.csproj".
1>Project "MyApp.csproj" (GetNativeManifest target(s)):
1>Done building project "MyApp.csproj".
1>Project "MyApp.csproj" (GetNativeManifest target(s)):
1>Done building project "MyApp.csproj".
1>"obj\Debug\MyApp.Android.dll;obj\Debug\MyApp.Android.dll" is an invalid value for the "OutputAssembly" parameter of the "Csc" task. Multiple items cannot be passed into a parameter of type "Microsoft.Build.Framework.ITaskItem".
1>Done building project "MyApp.Android.csproj" -- FAILED.
1>Build FAILED.

I also tried to delete the bin en obj folders, clean and rebuild the Solution and deleting the MyApp.Android.dll.
But after the Rebuild the exact same thing happens again.

I do get the following warning:

Severity    Code    Description Project File    Line    Suppression State
Warning IDE0006 Error encountered while loading the project. Some project features, such as full solution analysis for the failed project and projects that depend on it, have been disabled.   BarApp.Android      1   Active
How to solve:

You have to set your Project Linking to Sdk Assemblies Only and set support architecture to armeabi - v7 and x86.

after try to clean and rebuild the project

It work like charm.

###

If you are using the portable class library (PCL) approach to organize your code between Android and iOS, you can unload the Android project by right-clicking it and selecting menu option “Unload Project” in Visual Studio. Then recompile the PCL project, reload the Android project again (right click -> “Reload Project”) and rebuild the solution. This time it should give no error. Now try to run the app again on Android emulator.

You may have to also restart the emulator and uninstall the app from the emulator/device before being able to run it succesfully again.

###

Open project in File Explorer, delete bin and obj file from the solution, go to the solution.

  1. Right click in droid project go to option

  2. Select Android option set your Project Linking to SDK Assemblies Only and click advanced set support architecture to armeabi-v7 and x86.

  3. Finally to clean and rebuild the project.

###

I had to clean the project, delete the bin folder (just to be sure), then the build failed with the real reason: an incorrect reference.

Someone copied a project dll instead of linking to the project.

Corrected the reference and all was well.

Leave a Reply

Your email address will not be published. Required fields are marked *