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

Viewed 538

I can't resolve my problem very long time...

I have main application and some plugins, libs that loads in runtime. I created a new sample application, they imitated my issue.

Main app:

string exepath = Path.GetDirectoryName( Assembly.GetExecutingAssembly().Location);
string asmname = Path.Combine(exepath, "TestSql.dll");
var asm = Assembly.LoadFrom(asmname);
var type = asm.GetType("TestSql.Class1");

var class1 = Activator.CreateInstance(type);

Second project:

using System.Data.SqlClient;

namespace TestSql 
{
    public class Class1 
    {
        public Class1() 
        {
            SqlConnection sqlConnection = new SqlConnection();
        }
    }
}

And some screenshots:

enter image description here

enter image description here

You can simply repeat it.

What I use:

  • NetCore 3.1
  • System.Data.SqlClient 4.8.1 (I tried to use Microsoft.Data.SqlClient 2.0 - same error)

Please help me ((

Great thanks!

0 Answers
Related