Notice (2018-05-24): bugzilla.xamarin.com is now in
Please join us on
Visual Studio Developer Community and in the
Mono organizations on
GitHub to continue tracking issues. Bugzilla will remain
available for reference in read-only mode. We will continue to work
on open Bugzilla bugs, copy them to the new locations
as needed for follow-up, and add the new items under Related
Our sincere thanks to everyone who has contributed on this bug
tracker over the years. Thanks also for your understanding as we
make these adjustments and improvements for the future.
Please create a new report on
GitHub or Developer Community with
your current version information, steps to reproduce, and relevant error
messages or log files if you are hitting an issue that looks similar to
this resolved bug and you do not yet see a matching new report.
Trying to use this:
//Set destination connection string
string connectionString = YourConnectionString;
SqlConnection Connection = new SqlConnection(connectionString);
//SMO Server object setup with SQLConnection.
Server server = new Server(new ServerConnection(Connection)); <---- PRODUCES ERROR
//Create a new SMO Database giving server object and database name
Database db = new Database(server, "TestSMODatabase");
Could not load type 'Microsoft.SqlServer.Server.SqlContext' from assembly 'System.Data, Version=22.214.171.124, Culture=neutral, PublicKeyToken=b77a5c561934e089'.
System.TypeLoadException: Could not load type 'Microsoft.SqlServer.Server.SqlContext' from assembly 'System.Data, Version=126.96.36.199, Culture=neutral, PublicKeyToken=b77a5c561934e089'.
at Microsoft.SqlServer.Management.Common.ConnectionManager..ctor (System.Data.SqlClient.SqlConnection sqlConnectionObject) [0x00000] in <filename unknown>:0
at Microsoft.SqlServer.Management.Common.ServerConnection..ctor (System.Data.SqlClient.SqlConnection sqlConnection) [0x00000] in <filename unknown>:0
at MainClass.Main (System.String args) [0x003bc] in Program.cs:107
Please attach a self-contained test case, and include operating system version, Mono version, package version for the code you are using.
It could be merely a package missing from your installation
We have not received the requested information. If you are still experiencing this issue please provide all the requested information and reopen the bug report.