Reputation: 119
Microsoft.Data.SqlClient is not supported on this platform
Working Solution
If switching AppContext.SetSwitch("Switch.Microsoft.Data.SqlClient.UseManagedNetworkingOnWindows", true); Setting this at starting working fine but this is not recommended to use by Microsoft
If referring MIcrosoft.Data.SQLClient.dll from runtimes\unix\lib\net6.0 it also works fine Don't know why but it doesn't seems good solution and can't use.
If installing the Microsoft.Data.SqlClient in console app (Can't update existing Component handler)
Platform (VS 2022 and Win 10 .Net 6)
Upvotes: 0
Views: 159
Reputation: 12370
You can't just “use” a dll, there's some work involved in loading the assembly, especially when it has platform-specific transitive dependencies.
This area of .Net is different under NetCore compared to NetFramework, so code that worked for NetFramework doesn't work for NetCore.
For .Net Framework, the discussion at Best Practices for Assembly Loading works.
For .Net Core, the discussion at Dependency Loading helps but a faster start might be working through Nate McMaster's Plugin code
Upvotes: 2