-
Notifications
You must be signed in to change notification settings - Fork 23
Description
After upgrading to Microsoft.Data.SqlClient 7.0.0 and installing the new <PackageReference Include="Microsoft.Data.SqlClient.Extensions.Azure" Version="1.0.0" /> to authenticate against Azure SQL with managed identity.
We get the following runtime error
Error Message: System.TypeLoadException : Could not load type 'Microsoft.Data.SqlClient.SqlAuthenticationMethod' from as
sembly 'Microsoft.Data.SqlClient, Version=7.0.0.0, Culture=neutral, PublicKeyToken=23ec7fc2d6eaa4a5'.
Stack Trace:
at Microsoft.SqlServer.Management.Common.ConnectionSettings.InitFromSqlConnection(SqlConnection sc)
at Microsoft.SqlServer.Management.Common.ConnectionSettings.InitFromSqlConnection(SqlConnection sc)
at Microsoft.SqlServer.Management.Common.ConnectionManager..ctor(SqlConnection sqlConnectionObject, IRenewableToken ac
cessToken)
at Microsoft.SqlServer.Management.Common.ServerConnection..ctor(SqlConnection sqlConnection, IRenewableToken accessTok
en)
at Microsoft.SqlServer.Management.Common.ServerConnection..ctor(SqlConnection sqlConnection)
On the following line. Where we use a Azure AD connection string.
var smoServer = new Server(new ServerConnection(sqlConnection));
Related: https://github.com/dotnet/SqlClient/releases/tag/v7.0.0
On .net 10