Runtime: .NET Core 2.1 System.Data.SqlClient is not supported on this platform

Created on 14 Jan 2019  路  8Comments  路  Source: dotnet/runtime

I have a .NET Core 2.1 solution with different projects (.NET Core 2.1 and .NET Standard 2.0), built into a single application for x64 environment.
The application has to run on a Windows Server 2016 x64 machine.

While I was updating to a new release, when tried to execute it, I got this message:

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

Before updating, the application it was running fine. If I replace the new version with the old one, it executes correctly.

These are some information about the application, environment and DLLs:

Project: .NET Core 2.1.6 x64
Runtime: .NET Core 2.1.6 Runtime bundle
OS: Windows Server 2016 x64 with latest Windows updates

Dependency on System.Data.SqlClient.dll taken from MyApplication.deps.json file:

"Microsoft.EntityFrameworkCore.SqlServer/2.1.4": {
    "dependencies": {
      "Microsoft.EntityFrameworkCore.Relational": "2.1.4",
      "System.Data.SqlClient": "4.5.1"
    },
    "runtime": {
      "lib/netstandard2.0/Microsoft.EntityFrameworkCore.SqlServer.dll": {
        "assemblyVersion": "2.1.4.0",
        "fileVersion": "2.1.4.18263"
      }
    }
  },

If I remove the System.Data.SqlClient.dll file I get this error:

Error:
An assembly specified in the application dependencies manifest (Ecoprogetti.Dcs.WindowsService.deps.json) was not found:
package: 'System.Data.SqlClient', version: '4.5.1'
path: 'runtimes/win/lib/netcoreapp2.1/System.Data.SqlClient.dll'

Between the previous release of my application and this new one, I surely updated many packages with nuget, including the EF Core ones, till latest .NET Core 2.1 version that is 2.1.4, because I want to stay on .NET Core 2.1 LTS release.

If I compare the previous version of System.Data.SqlClient.dll and the new one, the DLLs differs only for file size and not for file version. Please see the attached screenshots.

Old DLL

image

New DLL

image

area-System.Data.SqlClient needs more info

All 8 comments

Hi @OculiViridi . Could you provide your application csproj file and the output of dotnet --info please?

Update 2019/01/15

Also I tried to execute the same application version on my develpment machine and it starts without any problem. I don't know if it can be related to the platform intended as Windows Server 2016...

@AfsanehR Hi! Here it is the .csproj file of the main project.

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>netcoreapp2.1</TargetFramework>
    <Platforms>x64</Platforms>
    <AssemblyVersion>1.0.0</AssemblyVersion>
    <Authors>MyCompany</Authors>
    <Description>MyCompany DCS庐 Windows Service</Description>
    <Copyright>漏 MyCompany All rights reserved.</Copyright>
    <FileVersion>1.0.0</FileVersion>
    <Product>MyCompany DCS庐 Windows Service</Product>
    <CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
  </PropertyGroup>
  <ItemGroup>
    <PackageReference Include="DasMulli.AspNetCore.Hosting.WindowsServices" Version="1.0.0" />
  </ItemGroup>
  <ItemGroup>
    <ProjectReference Include="..\MyCompany.Dcs.Engine\MyCompany.Dcs.Engine.csproj" />
  </ItemGroup>
</Project>

And this is the dotnet --info output on Windows Server 2016 machine.

image

@OculiViridi I tried running a sample application with the following csproj on Windows Server 2016. I am still unable to repro it. Would you be able to provide an adhoc repro?

Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>netcoreapp2.1</TargetFramework>
    <Platforms>x64</Platforms>
  </PropertyGroup>
  <ItemGroup>
     <PackageReference Include="DasMulli.AspNetCore.Hosting.WindowsServices" Version="1.0.0" />
    <PackageReference Include="System.Data.SqlClient" Version="4.5.1" />
  </ItemGroup>
</Project>

Here is the output of my dotnet --info:

.NET Core SDK (reflecting any global.json):
 Version:   2.1.503
 Commit:    4c506e0f35

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.14393
 OS Platform: Windows
 RID:         win10-x64
 Base Path:   C:\Program Files\dotnet\sdk\2.1.503\

Host (useful for support):
  Version: 2.1.7
  Commit:  cca5d72d48

.NET Core SDKs installed:
  1.1.11 [C:\Program Files\dotnet\sdk]
  2.1.202 [C:\Program Files\dotnet\sdk]
  2.1.503 [C:\Program Files\dotnet\sdk]

.NET Core runtimes installed:
  Microsoft.AspNetCore.All 2.1.7 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.App 2.1.7 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 1.0.13 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 1.1.10 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.0.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.1.7 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]

To install additional .NET Core runtimes or SDKs:
  https://aka.ms/dotnet-download

Would you be able to provide an adhoc repro?

I can't even reproduce it myself, except on the test machine where it is not currently working, as I said initially.

After a successfull build on my develpment machine, if I take the build folder and move it to C:\ and execute, everything is working without any problem.

The same build directory copy/pasted as is inside the C:\ of server (as done with my previous application versions), when trying to execute leads now to this error:

Error:
  An assembly specified in the application dependencies manifest (MyCompany.Dcs.WindowsService.deps.json) was not found:
    package: 'System.Data.SqlClient', version: '4.5.1'
    path: 'runtimes/win/lib/netcoreapp2.1/System.Data.SqlClient.dll'

but the file is in place, since the folder is exactly the same as the one in my development machine.

@OculiViridi This issue is not reproducible on our end. I will close this issue for now but let us know if you were able to provide more detailed information. Thanks

I have same problem. App run on x86 platform
When I was debugging, dotnet load assembly from path "C:\Program Files\dotnet\sdk\NuGetFallbackFolder\system.data.sqlclient\4.5.1\runtimes\win\lib\netcoreapp2.1System.Data.SqlClient.dll".
When I publish the project, the framework will copy from path "C:\Program Files\dotnet\sdk\NuGetFallbackFolder\system.data.sqlclient\4.5.1\lib\netcoreapp2.1System.Data.SqlClient.dll"

I am having the same issue on a windows 2019 server using .net core 3.1

I had 3.1.3 Hosting Bundle on Windows Server 2016. Project consists of Microsoft.EntityFrameworkCore.SqlServer v3.1.3... Ran fine running the exe via command line, however when running as a Windows Service (IHostBuilder), started to see "Error: Microsoft.Data.SqlClient is not supported on this platform." Went to NuGet and downloaded Microsoft.Data.SqlClient v1.1.2 (latest as of today). Redeployed. Now it all worked!

Seems Microsoft.EntityFrameworkCore.SqlServer need to pull in the Microsoft.Data.SqlClient library.

Was this page helpful?
0 / 5 - 0 ratings