.NET 6 System.PlatformNotSupportedException: Microsoft.Data.SqlClient is not supported on this platform With Fitnesse

6.5k views Asked by At

When creating a new .net 6 project with Microsoft.Data.SqlClient It works fine. But When running through a .net 6 fitnesse project with fitsharp we are getting this error:

System.PlatformNotSupportedException: Microsoft.Data.SqlClient is not supported on this platform

Dependancies:

  1. Fitsharp 2022.1.15
  2. Lextm.SharpSnmpLib 12.4.0
  3. Microsoft.Data.SqlClient 4.1.0

I've tried adding <CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies> to .csproj

That bypassed some errors, But the PlatformNotSupportedExcpetion is still present.

When converting to a console app and running from program. It works fine. But it won't work when running through fitnesse with fitsharp

1

There are 1 answers

1
Kieran On BEST ANSWER

The work around for now was to downgrade Microsoft.Data.SqlClient to 2.0.1. And install the Microsoft.Data.SqlClient.SNI.Runtime v2.0.1 nuget package. Having <CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies> was needed, but this didn't copy the Microsoft.Data dll's to bin on build. So These two dll's needed to be move to bin:

  1. packages\microsoft.data.sqlclient.sni.runtime\2.0.1\runtimes\win-x64\native\Microsoft.Data.SqlClient.SNI.dll

  2. packages\microsoft.data.sqlclient\2.0.1\runtimes\win\lib\netcoreapp3.1\Microsoft.Data.SqlClient.dll

A Similar solution was found here for .NET Core 3.1:

Issues for Fitsharp in Github

Naun, answered it on 13th July, but the difference for .NET 6 was to also install the Microsoft.Data.SqlClient.SNI.Runtime v2.0.1 nuget package and copy different versions of the dll's