PlatformNotSupportedException with System.Data.SqlClient

Viewed 430

Let me describe my problem. I've currently 2 layers in my project:

  • ApplicationLayer: .Net Framework 4.7.2
  • InfrastructureLayer: .Net Standard 2.0

The infrastructure layer has the database related code while the application layer just references it. I'm using Dapper along with an Sql server.

The issue is that everything works fine in local, all the unit tests pass but whenever I commit the changes, the CI pipeline (azure pipelines in this case) throws an "PlatformNotSupportedException" when running the exact same tests. Both platforms (local and azure agent) are Windows x64.

Exception stacktrace:

System.PlatformNotSupportedException: System.Data.SqlClient is not supported on this platform.
at System.Data.SqlClient.SqlConnection..ctor(String connectionString)
at Infrastructure.Repositories.SqlConnectionFactory.CreateConnection()

Looks like the issue is directly related to the System.Data.SqlClient dll which is installed in both projects (just in case) as a Nuget package (current version is 4.8.1).

0 Answers
Related