Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using System.Data.SqlClient 4.6.0 throws PlatformNotSupportedException #2050

Open
CasperWSchmidt opened this issue Dec 7, 2018 · 8 comments
Milestone

Comments

@CasperWSchmidt
Copy link

I just updated System.Data.SqlClient from 4.5.1 to 4.6 (not preview) and got the same error message as described here https://github.com/dotnet/corefx/issues/33620.

Repro steps

Provide the steps required to reproduce the problem

  1. create any project with a dependency on System.Data.SqlClient version 4.6.0

  2. Try to run it on Azure Functions

Expected behavior

It should not fail.

Actual behavior

Throwing PlatformNotSupportedException.

Known workarounds

Downgrading to 4.5.1 works.

@JohnReeson
Copy link

JohnReeson commented Dec 7, 2018

There seems some problem when it comes to references related to runtime assemblies, check this issue.

Right click on Function project and Edit <FunctionAppName>.csproj, add items below to copy related assemblies to output dir.

 <!-- For publish -->
  <ItemGroup>
    <None Include="$(USERPROFILE)\.nuget\packages\system.data.sqlclient\4.6.0\runtimes\win\lib\netcoreapp2.1\System.Data.SqlClient.dll">
      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
    </None>
  </ItemGroup>

  <!-- For local debug -->
  <Target Name="CopyToBin" BeforeTargets="Build">
    <Copy SourceFiles="$(USERPROFILE)\.nuget\packages\system.data.sqlclient\4.6.0\runtimes\win\lib\netcoreapp2.1\System.Data.SqlClient.dll" DestinationFolder="$(OutputPath)\bin" />
  </Target>

@CasperWSchmidt
Copy link
Author

Possibly. I don't need 4.6.0 so I will stick to 4.5.1 for the time being. Just wanted to report the issue to make sure someone knows about it :)

@bartdk-be
Copy link

@JohnReeson : Thanks for the possible workaround. But it's not working over here ?
Since we are using Microsoft.EntityFrameworkCore.SqlServer 2.2.0, a downgrade to 4.5.1 is not possible.

Any idea on when this could be fixed ?

@ConradIlgmann
Copy link

Same for me. Working with Microsoft.EntityFrameworkCore.SqlServer 2.2.0 and get:

System.Private.CoreLib: One or more errors occurred. (System.Data.SqlClient is not supported on this platform.)

@alvipeo
Copy link

alvipeo commented Dec 18, 2018

Same here

@kvaes
Copy link

kvaes commented Jan 23, 2019

Can confirm that the issue still exists in (preview) versions beyond 4.6.0.
And... also important to note... that @JohnReeson 's workaround does work.

2019-01-23 16_49_39-mremoteng - confcons xml - my little dev machine
2019-01-23 16_49_51-mremoteng - confcons xml - my little dev machine
(The error is a good sign... as the error occured before actually being able to get a connection error) :)

@zippy1981
Copy link

This workaround is still working locally, but it does not work on Azure Devops anymore. Last time I did a build was December 2018. Yesterday (3/5/2019) The build failed to find the dll in the user nuget path on the build host:

C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(4582,5): Error MSB3030: Could not copy the file "C:\Users\VssAdministrator\.nuget\packages\system.data.sqlclient\4.6.0\runtimes\win\lib\netcoreapp2.1\System.Data.SqlClient.dll" because it was not found.

Process 'msbuild.exe' exited with code '1'.

Is it in another folder?

@adrianknight89
Copy link

I'm having this issue with 4.7.0 preview.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants