Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Microsoft SqlServer Management: method not found creating a ServerConnection

Microsoft.SqlServer.SqlManagementObjects 161.47027.0

Microsoft.Data.SqlClient 5.0.0

After upgrading Microsoft.Data.SqlClient from 4.1.0 to 5.0.0 I got this error creating a ServerConnection object:

using Microsoft.SqlServer.Management.Common;

var serverConnection = new ServerConnection("localhost", "sa", "mypwd");

System.MissingMethodException: 'Method not found: 'Void Microsoft.Data.SqlClient.SqlConnectionStringBuilder.set_Encrypt(Boolean)

It looks for a not implemented set_Encrypt method inside a Microsoft.Data.SqlClient.SqlConnectionStringBuilder

Does it mean Microsoft.SqlServer.SqlManagementObjects has not been updated yet to support Microsoft.Data.SqlClient 5.0.0?

If so do I need to wait for this update before I can upgrade Microsoft.Data.SqlClient 5.0.0 into my project?

like image 969
Ghini Antonio Avatar asked May 11 '26 04:05

Ghini Antonio


1 Answers

You can also upgrade the ServerManagementObjects reference to 170.7.0-preview to resolve. Apparently the issue is with the smo library not the sqlclient library. https://github.com/dotnet/SqlClient/issues/1702

Their code should be backwards compatible, but they need to be recompiled against MDS 5.0

like image 119
Jon Avatar answered May 13 '26 19:05

Jon



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!