We recently upgraded our C# projects from .NET Framework 4.5.2 to .NET 6.0, and now the line
System.Data.Sql.SqlDataSourceEnumerator.Instance.GetDataSources()
no longer works. As far as I can tell, the class SqlDataSourceEnumerator
is just not included in the System.Data
assembly for .NET 6.0.
I've looked online for other ways to get available SQL Servers, but all of ones I've found either recommend using SqlDataSourceEnumerator
, or SmoApplication.EnumAvailableSqlServers()
which relies on it internally.
What other ways are there to get available SQL Servers in our C# code that are compatible with .NET 6.0? We need a solution that returns the same info as before (including Server, Name, Instance, Version, and IsLocal).