Fody - System.Security.SecurityException: Invalid assembly public key - visual-studio

I just tried adding a Fody NuGet package to my C# project and now anytime I try to build I get the following error.
error MSB4018: The "ResolveAssemblyReference" task failed unexpectedly.
error MSB4018: System.Security.SecurityException: Invalid assembly public key. (Exception from HRESULT: 0x8013141E)
error MSB4018: at System.Reflection.AssemblyName.nToString()
error MSB4018: at System.Reflection.AssemblyName.get_FullName()
error MSB4018: at Microsoft.Build.Tasks.ReferenceTable.MarkReferencesForExclusion(Dictionary`2 exclusionList)
error MSB4018: at Microsoft.Build.Tasks.ResolveAssemblyReference.Execute(FileExists fileExists, DirectoryExists directoryExists, GetDirectories getDirectories, GetAssemblyName getAssemblyName, GetAssemblyMetadata getAssemblyMetadata, GetRegistrySubKeyNames getRegistrySubKeyNames, GetRegistrySubKeyDefaultValue getRegistrySubKeyDefaultValue, GetLastWriteTime getLastWriteTime, GetAssemblyRuntimeVersion getRuntimeVersion, OpenBaseKey openBaseKey, GetAssemblyPathInGac getAssemblyPathInGac, IsWinMDFile isWinMDFile, ReadMachineTypeFromPEHeader readMachineTypeFromPEHeader)
error MSB4018: at Microsoft.Build.Tasks.ResolveAssemblyReference.Execute()
error MSB4018: at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
error MSB4018: at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext()
error MSB4018: The Zone of the assembly that failed was:
error MSB4018: MyComputer
I've tried uninstalling and re-installing, different add-ins/weavers. It always ends up with the same result. My solution has two projects, a .NET Standard 2.0 library and a .NET Framework 4.6.1 class library containing unit tests. The Standard library builds but the unit test project is the one failing.

Related

<DebugType>none</DebugType> leads to Xamarin App not compiling in Debug

In Visual Studio 2022 with a Xamarin project that works and builds going through the "release steps" from https://learn.microsoft.com/en-us/xamarin/android/deploy-test/release-prep/?tabs=windows leads to a project that will only build in release mode. In debug mode the below errors occur. AFTER HOURS of tracking it down I am able to fix the build by removing the following line from the project file in the section.
<DebugType>none</DebugType>
This is the error when in Debug mode with the above line in the project file. Build works just fine in release. Main error appears to be The "XamlCTask" task failed unexpectedly.
Build started...
1>------ Build started: Project: TechClient.Mobile, Configuration: Debug Any CPU ------
1>C:\Users\marti\.nuget\packages\xamarin.forms\5.0.0.2401\buildTransitive\Xamarin.Forms.targets(119,3): error MSB4018: The "XamlCTask" task failed unexpectedly.
1>C:\Users\marti\.nuget\packages\xamarin.forms\5.0.0.2401\buildTransitive\Xamarin.Forms.targets(119,3): error MSB4018: System.Runtime.Serialization.SerializationException: Unable to find assembly 'Mono.Cecil, Version=0.10.3.0, Culture=neutral, PublicKeyToken=50cebf1cceb9d05e'.
1>C:\Users\marti\.nuget\packages\xamarin.forms\5.0.0.2401\buildTransitive\Xamarin.Forms.targets(119,3): error MSB4018:
1>C:\Users\marti\.nuget\packages\xamarin.forms\5.0.0.2401\buildTransitive\Xamarin.Forms.targets(119,3): error MSB4018: Server stack trace:
1>C:\Users\marti\.nuget\packages\xamarin.forms\5.0.0.2401\buildTransitive\Xamarin.Forms.targets(119,3): error MSB4018: at System.Runtime.Serialization.Formatters.Binary.BinaryAssemblyInfo.GetAssembly()
1>C:\Users\marti\.nuget\packages\xamarin.forms\5.0.0.2401\buildTransitive\Xamarin.Forms.targets(119,3): error MSB4018: at System.Runtime.Serialization.Formatters.Binary.ObjectReader.GetType(BinaryAssemblyInfo assemblyInfo, String name)
1>C:\Users\marti\.nuget\packages\xamarin.forms\5.0.0.2401\buildTransitive\Xamarin.Forms.targets(119,3): error MSB4018: at System.Runtime.Serialization.Formatters.Binary.ObjectMap..ctor(String objectName, String[] memberNames, BinaryTypeEnum[] binaryTypeEnumA, Object[] typeInformationA, Int32[] memberAssemIds, ObjectReader objectReader, Int32 objectId, BinaryAssemblyInfo assemblyInfo, SizedArray assemIdToAssemblyTable)
1>C:\Users\marti\.nuget\packages\xamarin.forms\5.0.0.2401\buildTransitive\Xamarin.Forms.targets(119,3): error MSB4018: at System.Runtime.Serialization.Formatters.Binary.__BinaryParser.ReadObjectWithMapTyped(BinaryObjectWithMapTyped record)
1>C:\Users\marti\.nuget\packages\xamarin.forms\5.0.0.2401\buildTransitive\Xamarin.Forms.targets(119,3): error MSB4018: at System.Runtime.Serialization.Formatters.Binary.__BinaryParser.Run()
1>C:\Users\marti\.nuget\packages\xamarin.forms\5.0.0.2401\buildTransitive\Xamarin.Forms.targets(119,3): error MSB4018: at System.Runtime.Serialization.Formatters.Binary.ObjectReader.Deserialize(HeaderHandler handler, __BinaryParser serParser, Boolean fCheck, Boolean isCrossAppDomain, IMethodCallMessage methodCallMessage)
1>C:\Users\marti\.nuget\packages\xamarin.forms\5.0.0.2401\buildTransitive\Xamarin.Forms.targets(119,3): error MSB4018: at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize(Stream serializationStream, HeaderHandler handler, Boolean fCheck, Boolean isCrossAppDomain, IMethodCallMessage methodCallMessage)
1>C:\Users\marti\.nuget\packages\xamarin.forms\5.0.0.2401\buildTransitive\Xamarin.Forms.targets(119,3): error MSB4018: at System.Runtime.Remoting.Channels.CrossAppDomainSerializer.DeserializeObject(MemoryStream stm)
1>C:\Users\marti\.nuget\packages\xamarin.forms\5.0.0.2401\buildTransitive\Xamarin.Forms.targets(119,3): error MSB4018: at System.Runtime.Remoting.Messaging.SmuggledMethodReturnMessage.FixupForNewAppDomain()
1>C:\Users\marti\.nuget\packages\xamarin.forms\5.0.0.2401\buildTransitive\Xamarin.Forms.targets(119,3): error MSB4018: at System.Runtime.Remoting.Channels.CrossAppDomainSink.SyncProcessMessage(IMessage reqMsg)
1>C:\Users\marti\.nuget\packages\xamarin.forms\5.0.0.2401\buildTransitive\Xamarin.Forms.targets(119,3): error MSB4018:
1>C:\Users\marti\.nuget\packages\xamarin.forms\5.0.0.2401\buildTransitive\Xamarin.Forms.targets(119,3): error MSB4018: Exception rethrown at [0]:
1>C:\Users\marti\.nuget\packages\xamarin.forms\5.0.0.2401\buildTransitive\Xamarin.Forms.targets(119,3): error MSB4018: at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
1>C:\Users\marti\.nuget\packages\xamarin.forms\5.0.0.2401\buildTransitive\Xamarin.Forms.targets(119,3): error MSB4018: at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
1>C:\Users\marti\.nuget\packages\xamarin.forms\5.0.0.2401\buildTransitive\Xamarin.Forms.targets(119,3): error MSB4018: at Microsoft.Build.Framework.ITask.Execute()
1>C:\Users\marti\.nuget\packages\xamarin.forms\5.0.0.2401\buildTransitive\Xamarin.Forms.targets(119,3): error MSB4018: at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
1>C:\Users\marti\.nuget\packages\xamarin.forms\5.0.0.2401\buildTransitive\Xamarin.Forms.targets(119,3): error MSB4018: at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext()
1>Done building project "TechClient.Mobile.csproj" -- FAILED.
Why was the "debug" line added and is it needed? What should I do about it to keep the security that the preparing a Xamarin for release document talks about?
So far I have just been removing the none line when I want to debug and adding it back in for releases.

How to downgrade/configure elder Mono in Visual Studio For Mac?

I am trying to build old code with Visual Studio For Mac and getting the following error:
Target XamlC:
Compiling Xaml
Assembly: obj/Debug/OxyPlot.Xamarin.Forms.dll
...
/Users/.../MyProject/packages/Xamarin.Forms.2.3.3.193/build/portable-win+net45+wp80+win81+wpa81+MonoAndroid10+Xamarin.iOS10+xamarinmac20/Xamarin.Forms.targets(62,3): error MSB4018: The "XamlCTask" task failed unexpectedly.
/Users/.../MyProject/packages/Xamarin.Forms.2.3.3.193/build/portable-win+net45+wp80+win81+wpa81+MonoAndroid10+Xamarin.iOS10+xamarinmac20/Xamarin.Forms.targets(62,3): error MSB4018: System.IO.FileNotFoundException: Could not find file "/Users/.../MyProject/OxyPlot/OxyPlot.Xamarin.Forms/obj/Debug/OxyPlot.Xamarin.Forms.dll.mdb"
/Users/.../MyProject/packages/Xamarin.Forms.2.3.3.193/build/portable-win+net45+wp80+win81+wpa81+MonoAndroid10+Xamarin.iOS10+xamarinmac20/Xamarin.Forms.targets(62,3): error MSB4018: File name: '/Users/.../MyProject/OxyPlot/OxyPlot.Xamarin.Forms/obj/Debug/OxyPlot.Xamarin.Forms.dll.mdb'
/Users/.../MyProject/packages/Xamarin.Forms.2.3.3.193/build/portable-win+net45+wp80+win81+wpa81+MonoAndroid10+Xamarin.iOS10+xamarinmac20/Xamarin.Forms.targets(62,3): error MSB4018:
/Users/.../MyProject/packages/Xamarin.Forms.2.3.3.193/build/portable-win+net45+wp80+win81+wpa81+MonoAndroid10+Xamarin.iOS10+xamarinmac20/Xamarin.Forms.targets(62,3): error MSB4018:
/Users/.../MyProject/packages/Xamarin.Forms.2.3.3.193/build/portable-win+net45+wp80+win81+wpa81+MonoAndroid10+Xamarin.iOS10+xamarinmac20/Xamarin.Forms.targets(62,3): error MSB4018: Server stack trace:
...
I read here, that it is possible to use elder Mono (4.8) to build project. How to do this?

Can't compile Xamarin android project with StructureMap in release mode

Create a blank android project Blank App (Android) in Visual Studio then add the following nuget packages
NETStandard.Library 1.6.1
StructureMap 4.5.2
Now try to compile the project in release mode.
I get the following error:
Using "LinkAssemblies" task from assembly "C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Build.Tasks.dll".
Task "LinkAssemblies"
LinkAssemblies Task
UseSharedRuntime: False
MainAssembly: obj\Release\linksrc\App2.dll
OutputDirectory: obj\Release\android\assets\
OptionalDestinationDirectory:
I18nAssemblies:
LinkMode: SdkOnly
LinkSkip:
LinkDescriptions:
ResolvedAssemblies:
obj\Release\linksrc\App2.dll
obj\Release\linksrc\Java.Interop.dll
obj\Release\linksrc\Mono.Android.dll
obj\Release\linksrc\System.Core.dll
obj\Release\linksrc\System.dll
obj\Release\linksrc\System.IO.Compression.dll
obj\Release\linksrc\System.Net.Http.dll
obj\Release\linksrc\System.Xml.dll
obj\Release\linksrc\mscorlib.dll
obj\Release\linksrc\StructureMap.dll
obj\Release\linksrc\System.Runtime.Loader.dll
obj\Release\linksrc\System.Runtime.dll
obj\Release\linksrc\System.ComponentModel.Composition.dll
obj\Release\linksrc\System.Threading.dll
obj\Release\linksrc\System.Collections.dll
obj\Release\linksrc\System.Collections.Concurrent.dll
obj\Release\linksrc\System.Reflection.dll
obj\Release\linksrc\System.Diagnostics.Debug.dll
obj\Release\linksrc\System.Linq.dll
obj\Release\linksrc\System.Runtime.InteropServices.dll
obj\Release\linksrc\System.Runtime.Extensions.dll
obj\Release\linksrc\System.Reflection.Extensions.dll
obj\Release\linksrc\System.Runtime.Serialization.dll
obj\Release\linksrc\System.ServiceModel.Internals.dll
obj\Release\linksrc\Mono.Security.dll
obj\Release\linksrc\System.Resources.ResourceManager.dll
obj\Release\linksrc\System.IO.dll
obj\Release\linksrc\System.Threading.Tasks.dll
obj\Release\linksrc\System.Linq.Expressions.dll
obj\Release\linksrc\System.Reflection.Emit.Lightweight.dll
obj\Release\linksrc\System.Reflection.Emit.ILGeneration.dll
obj\Release\linksrc\System.Reflection.TypeExtensions.dll
obj\Release\linksrc\System.Reflection.Primitives.dll
obj\Release\linksrc\System.Globalization.dll
obj\Release\linksrc\System.AppContext.dll
obj\Release\linksrc\System.IO.FileSystem.dll
obj\Release\linksrc\System.Console.dll
EnableProguard: False
ProguardConfiguration:
DumpDependencies: False
LinkOnlyNewerThan:
HttpClientHandlerType:
TlsProvider:
C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1577,5): error MSB4018: The "LinkAssemblies" task failed unexpectedly.
C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1577,5): error MSB4018: Mono.Linker.MarkException: Error processing method: 'System.Boolean StructureMap.Graph.AssemblyFinder/<FindAssemblies>
d__1::MoveNext()' in assembly: 'StructureMap.dll' ---> Mono.Cecil.ResolutionException: Failed to resolve System.Runtime.Loader.AssemblyLoadContext System.Runtime.Loader.AssemblyLoadContext::get_Default()
C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1577,5): error MSB4018: at Mono.Linker.Steps.MarkStep.HandleUnresolvedMethod(MethodReference reference)
C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1577,5): error MSB4018: at Mono.Linker.Steps.MarkStep.MarkMethod(MethodReference reference)
C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1577,5): error MSB4018: at Mono.Linker.Steps.MarkStep.MarkInstruction(Instruction instruction)
C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1577,5): error MSB4018: at Mono.Linker.Steps.MarkStep.MarkMethodBody(MethodBody body)
C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1577,5): error MSB4018: at Mono.Linker.Steps.MarkStep.ProcessMethod(MethodDefinition method)
C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1577,5): error MSB4018: at Mono.Linker.Steps.MarkStep.ProcessQueue()
C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1577,5): error MSB4018: --- End of inner exception stack trace ---
C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1577,5): error MSB4018: at Mono.Linker.Steps.MarkStep.ProcessQueue()
C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1577,5): error MSB4018: at Mono.Linker.Steps.MarkStep.Process()
C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1577,5): error MSB4018: at Mono.Linker.Steps.MarkStep.Process(LinkContext context)
C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1577,5): error MSB4018: at Mono.Linker.Pipeline.Process(LinkContext context)
C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1577,5): error MSB4018: at MonoDroid.Tuner.Linker.Process(LinkerOptions options, LinkContext& context)
C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1577,5): error MSB4018: at Xamarin.Android.Tasks.LinkAssemblies.Execute(DirectoryAssemblyResolver res)
C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1577,5): error MSB4018: at Xamarin.Android.Tasks.LinkAssemblies.Execute()
C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1577,5): error MSB4018: at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1577,5): error MSB4018: at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext()
Done executing task "LinkAssemblies" -- FAILED.
Done building target "_LinkAssembliesShrink" in project "App2.csproj" -- FAILED.
Build FAILED.
In debug mode it compiles as expected but i guess the LinkAssemblies task does not run then.
I'm using Xamarin 4.6.0.297 and Visual Studio 2015.
Is this an issue in StructureMap or Xamarin?
Update:
The seems to be an issue with the Linker and different versions of NetStandard Library. StructureMap is setup as a supporting .Net45, NetStandard 1.3 and NetStandard 1.5 in the nuget, when added NetStandard Lib 1.6 is being brought in and unless you update the packages to NetStandard Lib 2.0 (and its matching libraries), you will receive the Mono.Cecil error:
Mono.Cecil.ResolutionException: Failed to resolve System.Runtime.Loader.AssemblyLoadContext System.Runtime.Loader.AssemblyLoadContext::get_Default()
Note: I'm not sure if this is a problem with Mono.Cecil, the way StructureMap is packaged or the way Xamarin handles the nuget references...
LinkDescription:
A linker configuration like the following will get you around the issue:
<linker>
<assembly fullname="StructureMap">
<namespace fullname="StructureMap.*" />
</assembly>
</linker>
Just add an XML file to your project with the contents from above and assign a build action of LinkDescription to it.
Note: Using AndroidLinkSkip to skip the assembly will not work...
For me, adding a LinkDescription file, using AndroidLinkToSkip, and updating to .NETStandard 2.0 all did not work. Instead, I downgraded StructureMap to 4.4.0 as suggested by https://github.com/structuremap/structuremap/pull/597. That seems to have resolved the issue

getting error MSB4018: The "LinkAssemblies" task failed unexpectedly. for Xamarin Android in Visual Studio 2015

I'm getting this error on Release build when I use an obfuscator (.NET Reactor):
1>C:\Program Files
(x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1586,5):
error MSB4018: The "LinkAssemblies" task failed unexpectedly.
1>C:\Program Files
(x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1586,5):
error MSB4018: System.ArgumentException: Empty name
1>C:\Program Files
(x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1586,5):
error MSB4018: at Mono.Cecil.Mixin.CheckName(String name)
1>C:\Program Files
(x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1586,5):
error MSB4018: at Mono.Cecil.ModuleDefinition.GetType(String
namespace, String name)
1>C:\Program Files
(x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1586,5):
error MSB4018: at
Mono.Cecil.MetadataResolver.GetTypeDefinition(ModuleDefinition module,
TypeReference type)
1>C:\Program Files
(x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1586,5):
error MSB4018: at
Mono.Cecil.MetadataResolver.GetType(ModuleDefinition module,
TypeReference reference)
1>C:\Program Files
(x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1586,5):
error MSB4018: at Mono.Cecil.MetadataResolver.Resolve(TypeReference
type)
1>C:\Program Files
(x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1586,5):
error MSB4018: at Mono.Cecil.ModuleDefinition.Resolve(TypeReference
type)
1>C:\Program Files
(x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1586,5):
error MSB4018: at Mono.Cecil.TypeReference.Resolve()
1>C:\Program Files
(x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1586,5):
error MSB4018: at
Mono.Linker.Steps.SweepStep.ResolveAllTypeReferences(AssemblyDefinition
assembly)
1>C:\Program Files
(x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1586,5):
error MSB4018: at Mono.Linker.Steps.SweepStep.Process()
1>C:\Program Files
(x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1586,5):
error MSB4018: at Mono.Linker.Steps.BaseStep.Process(LinkContext
context)
1>C:\Program Files
(x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1586,5):
error MSB4018: at Mono.Linker.Pipeline.Process(LinkContext context)
1>C:\Program Files
(x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1586,5):
error MSB4018: at MonoDroid.Tuner.Linker.Process(LinkerOptions
options, LinkContext& context)
1>C:\Program Files
(x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1586,5):
error MSB4018: at Xamarin.Android.Tasks.LinkAssemblies.Execute()
1>C:\Program Files
(x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1586,5):
error MSB4018: at
Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
1>C:\Program Files
(x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1586,5):
error MSB4018: at
Microsoft.Build.BackEnd.TaskBuilder.d__26.MoveNext()
I'm using Visual Studio 2015 with Xamarin extension for Visual Studio v4.2.2.11 (file Xamarin.VisualStudio_4.2.2.11.msi), Xamarin Android v7.0.2.42, MSBuild 2015 and .NET Reactor. Project is setup to use .NET FX v4.6.1 and Android Target v5.1 (API 22) and minimum version v4.4 (API 19).
Since I was getting this on my project, I tested this by creating a blank Android project without any code added to it, just the code created by the new blank project (button click) so there are no references to DLLs or 3rd party components.
Regards,
NCruz
I credit this answer to Lex Li who pointed out that I should try to disable each of the obfuscation features, and see which triggers the linker issue. There are several command line switches that I use to activate certain obfuscation features like so: -suppressildasm 1 -obfuscation 1 -stringencryption 1 -antitamp 1 ..etc. At first, I removed/deleted them all from the command line but it still had the error. Then I put them all back and instead put 0 instead of 1 (-suppressildasm 0) to deactivate each function. The suppressildasm feature was the one causing the error.

Getting "GetPrimaryCpuAbi task failed Unexpectedly." every time even if I try to build a simple android app on Visual Studio

I am using:
VS Community 2015 edition, Xamarin v4.2, Xamarin.Android v7
It Shows:
1>C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.Debugging.targets(283,2): error MSB4018: The "GetPrimaryCpuAbi" task failed unexpectedly.
1>C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.Debugging.targets(283,2): error MSB4018: System.TypeLoadException: Could not load type 'Xamarin.Android.Tasks.MSBuildExtensions' from assembly 'Xamarin.Android.Build.Tasks, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'.
1>C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.Debugging.targets(283,2): error MSB4018: at Xamarin.Android.Tasks.GetPrimaryCpuAbi.Execute()
1>C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.Debugging.targets(283,2): error MSB4018: at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
1>C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.Debugging.targets(283,2): error MSB4018: at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext()
Please Help
All you need to do is clean your Xamarin project. menu Build > Clean all

Resources