Azure Function - System.Data.SqlClient is not supported on this platform Azure Function - System.Data.SqlClient is not supported on this platform azure azure

Azure Function - System.Data.SqlClient is not supported on this platform


If you don't need the latest stable version 4.6.0, simply revert to 4.5.1 would work.

Otherwise the workaround is to load the assemblies on our own. 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>

There's an issue tracking this assembly reference problem.


I have downgrade the System.Data.SqlClient to 4.6.0 then it worked for me


I just ran into this with an Azure Functions instance that had somehow been configured to use .NET Core 3.0.0. I changed the configuration setting FUNCTIONS_EXTENSION_VERSION from beta to ~2. After I restarted it, it went back to using 2.0.x and this error went away.