问题
I previously asked a question concerning azure databases and was given a helpful solution, however to utilise that solution, I needed to install System.Data.SqlClient. I tried installing the NuGet package from microsoft but whenever I do, I get the following error. I'd really appreciate some help with this. The project is a cross-platform application using xamarin.forms and a portable class library. I'm trying to install it to Appname(portable) because that's where my scripts are. thank you.
Severity Code Description Project File Line Suppression State
Error Could not install package 'System.Data.SqlClient 4.3.0'.
You are trying to install this package into a project that targets '.NETPortable,
Version=v4.5,Profile=Profile259', but the package does not contain any assembly references
or content files that are compatible with that framework. For more information,
contact the package author. 0
回答1:
From http://portablelibraryprofiles.stephencleary.com/ , profile259 doesn't support system.data.sqlclient. It has windows phone in it.
Profile is for .NET Framework 4.5, Windows 8.0, Windows Phone 8.1, Windows Phone Silverlight 8.0.
Bigger picture is Xamarin and Mobile clients don't have a way to hit sql server directly. Build a service façade using webapi or such..... See https://blog.xamarin.com/developing-enterprise-apps-using-xamarin-forms for some ideas.
来源:https://stackoverflow.com/questions/43770293/cannot-instell-system-data-sqlclient-in-visual-studio-xamarin-project