我正在使用Visual Studio 2015和Xamarin Forms开发适用于Android和Windows的跨平台应用程序。
当我构建项目时,我没有任何问题。但是,如果我在Windows上运行应用程序并尝试连接到数据库,则会出现以下异常:
"System.IO.FileNotFoundException" in System.Data.SqlClient.dll ("Could not load file or assembly 'System.Threading.Thread, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. System could not specific file.") System.IO.FileNotFoundException
我尝试安装System.Threading.Thread
NuGet包,但收到此错误消息:
Error restoring package
以下是我之前使用的SqlConnection
代码:
try
{
conn.Open();
DisplayAlert("estado", "estado: " + conn.State, "ok");
}
catch (System.IO.FileNotFoundException eo)
{
DisplayAlert("estado", "ERROR1!!!!!!!!!!!!!\n" + eo.Message, "ok");
}
catch (Exception ex)
{
DisplayAlert("estado", "ERROR!!!!!!!!!!!!!\n"+ ex.Message, "ok");
}