Rick Najjar
Rick Najjar

Reputation: 41

Xamarin failed to resolve system.security.cryptography?

How would I solve this in Xamarin:

Failed to resolve System.Security.Cryptography.SHA256CryptoServiceProvider reference from System.Core, Version 4.0.0, Culture=Neutral, PublicKeyToken=b77a5c561934e089" (MT2002)

I am finding great difficulty with this problem as it has popped out of nowhere when running my solution on a real device rather than on a simulator.I would greatly appreciate any help :)

Upvotes: 2

Views: 1721

Answers (2)

poupou
poupou

Reputation: 43553

Xamarin.iOS ships System.Core, Version 2.1.0, ... (even if it includes newer API that what shipped with 2.1 / Silverlight).

The error above mention System.Core, Version 4.0.0, ... and that is not an assembly that ships with Xamarin.iOS, nor is it part of a PCL profile that is supported.

This generally happens because some of your binaries are compiled against the desktop MS .NET framework. Doing so can include type/member references to things that does not exists in the version shipped by Xamarin.

The solution is to rebuild such binaries against the SDK that ships with Xamarin.iOS or against one of the PCL profiles that it supports.

Note that setting the linker to "Don't link" only hides the error (at build time) and can get you with errors, leading to crash, at runtime (generally a bad trade off).

Upvotes: 4

Rick Najjar
Rick Najjar

Reputation: 41

Fixed It! All I had to to was change the build setting to "Don't Link".

Upvotes: 0

Related Questions