Share via


.Net Core 3.0 Console App. Microsoft.Data.SQLClient is not supported

Question

Thursday, May 28, 2020 2:46 PM

Hi.  I just tried to publish my first .net core app (console).  I set it to self-contained and copied the output manually to the server where I got a "Microsoft.Data.SqlClient is not supported on this platform" error.  It works locally of course.  Doing a Google dive I found post build steps to make sure that the [appname].deps.json and the function.deps.json files need to be there and they are.  Inside I see 

functions.deps.json

    Microsoft.Data.SqlClient/1.0.19269.1": {
        "dependencies": {
          "Microsoft.Identity.Client": "3.0.8",
          "Microsoft.Win32.Registry": "4.7.0",
          "System.Configuration.ConfigurationManager": "4.7.0",
          "System.Runtime.Caching": "4.7.0",
          "System.Security.Principal.Windows": "4.7.0",
          "System.Text.Encoding.CodePages": "4.7.0",
          "runtime.native.System.Data.SqlClient.sni": "4.7.0"
        },
        "runtime": {
          "runtimes/win/lib/netcoreapp2.1/Microsoft.Data.SqlClient.dll": {
            "assemblyVersion": "1.0.19269.1",
            "fileVersion": "1.0.19269.1"
          }
        }

as well as further references in the file under EF

"Microsoft.EntityFrameworkCore.SqlServer/3.1.3": {
        "dependencies": {
          "Microsoft.Data.SqlClient": "1.0.19269.1",
          "Microsoft.EntityFrameworkCore.Relational": "3.1.3"
        },
        "runtime": {
          "lib/netstandard2.0/Microsoft.EntityFrameworkCore.SqlServer.dll": {
            "assemblyVersion": "3.1.3.0",
            "fileVersion": "3.100.320.12804"
          }
        }

and even more

 "Microsoft.Data.SqlClient/1.0.19269.1": {
      "type": "package",
      "serviceable": true,
      "sha512": "sha512-p2xa+sUAt7IRNxCl8ZT77bd7qHVKookDJ4HDUc+ArWkFk204rIpFhHajCTQqomSbcYi+olwheqQrwr+ohGRmJw==",
      "path": "microsoft.data.sqlclient/1.0.19269.1",
      "hashPath": "microsoft.data.sqlclient.1.0.19269.1.nupkg.sha512"
    },

Any insight would be much appreciated.  Most help seems to be in the context of adding the missing files and/or web based tech's targeted Nuget packages.  Thank you.

All replies (3)

Thursday, May 28, 2020 3:33 PM

Hello,

See the following

https://github.com/dotnet/runtime/issues/29487

Please remember to mark the replies as answers if they help and unmarked them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.

NuGet BaseConnectionLibrary for database connections.

StackOverFlow


Thursday, May 28, 2020 3:50 PM

Thank you for the feedback.  I did see this post chain and I guess I am not making the connection because I am not trying to load using reflection at all.  For the purposes of this app I am not even using DI.  Thanks.


Thursday, May 28, 2020 5:18 PM

Maybe you need to be using Core 2.x

https://github.com/dotnet/sqlclient

Supportability

The Microsoft.Data.SqlClient package supports the below environments:

  • .NET Framework 4.6+
  • .NET Core 2.1+
  • .NET Standard 2.0+.