visual studio – What Data.SqlClient can be used with .net 8


I am trying to create a new project using VS 2022 community – c# class library.
The project is using Microsoft.Data.SqlClient. NuGet recommended to get version 5.8.2.
This did not work when using the DLL of the class library from a Console application c# targeting .net6. I was receiving an error

Microsoft.Data.SqlClient is not supported on this platform  

I then tried to lower the versions of Microsoft.Data.SqlClient to 4.0.5 and when calling this class from a Console application I receive

ystem.IO.FileNotFoundException
  HResult=0x80070002
  Message=Could not load file or assembly 'System.Runtime, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.

Can anyone suggest what combination of Tragert Frameword and Microsoft.DataSqlClient can work?
Thanks

Leave a Reply

Your email address will not be published. Required fields are marked *