As shared by @Marc, Microsoft.Data.SqlClient v6+ works with .net8+ and as per @it-all-makes-cents Microsoft.Data.SqlClient v5.2.3+ works with .net6 . thank you guys for solving this issue.