You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a dll (say TestLib.dll) that targets .NET Standard 2.0, which uses System.Data.SqlClient dll (this also targets .NET Standard 2.0).
Now I'm using the TestLib.dll in an application (say TestApp) that targets .NET 4.8. Running the application results in an exception
System.Data.SqlClient is not supported on this platform
It is because TestApp was loading the System.Data.SqlClient.dll that targets .NET Standard.
If I give the reference to the the System.Data.SqlClient.dll that targets .NET 4.6.1, it works.
To reproduce the issue:
Create a class library that targets .NET Standard 2.0 (TestLibrary)
In the TestLibrary, reference and use SqlClient (which targets .NET Standard 2.0) latest version (4.8.6) and create a function to query something from the database
Build/publish the TestLibrary
Create a console application (TestApp) with .NET 4.8 as target framework and use that class library
Invoke the function that is querying the database
Note: make sure TestApp is referencing SqlClient that targets .NET Standard 2.0.
When it tries to create a connection object, the exception occurs.
What is the reason for .NET 4.8 not supporting the SqlClient dll that targets .NET Standard 2.0?
The text was updated successfully, but these errors were encountered:
I have a dll (say TestLib.dll) that targets .NET Standard 2.0, which uses System.Data.SqlClient dll (this also targets .NET Standard 2.0).
Now I'm using the TestLib.dll in an application (say TestApp) that targets .NET 4.8. Running the application results in an exception
System.Data.SqlClient is not supported on this platform
It is because TestApp was loading the System.Data.SqlClient.dll that targets .NET Standard.
If I give the reference to the the System.Data.SqlClient.dll that targets .NET 4.6.1, it works.
To reproduce the issue:
Note: make sure TestApp is referencing SqlClient that targets .NET Standard 2.0.
When it tries to create a connection object, the exception occurs.
What is the reason for .NET 4.8 not supporting the SqlClient dll that targets .NET Standard 2.0?
The text was updated successfully, but these errors were encountered: