title: Azure functions runtime exception, the type initializer for system data sqlclient excetion, Unable to load DLL 'sni.dll'
body: <p>I am using <strong>aspnet core 3.0 and azure function v3-preview with system.data.sqlclient version 4.7.0</strong>
  When i try to run azure function(on both service queue trigger and time trigger) it gives below error :</p>
  
  <p>The type initializer for 'System.Data.SqlClient.TdsParser' threw an exception. The type initializer for 'System.Data.SqlClient.SNILoadHandle' threw an exception. Unable to load DLL 'sni.dll' or one of its dependencies: The specified module could not be found.</p>
  
  <p>I tried solutions from below links but didn't work:
  1. <a href="https://stackoverflow.com/questions/53952409/azure-function-system-data-sqlclient-is-not-supported-on-this-platform">Azure Function - System.Data.SqlClient is not supported on this platform</a>
  2. <a href="https://github.com/Azure/app-service-announcements-discussions/issues/9" rel="nofollow noreferrer">https://github.com/Azure/app-service-announcements-discussions/issues/9</a></p>
  
  <p>I tried using <strong>"Microsoft.Data.SqlClient" for aspnetcore 3.0</strong> But still the same exception occurs while running Azure function on Azure portal.</p>
  
  <p>Please help !</p>
  
  <p>Here is csproj file</p>
  
  <pre><code>&lt;Project Sdk="Microsoft.NET.Sdk"&gt;
    &lt;PropertyGroup&gt;
      &lt;TargetFramework&gt;netcoreapp3.0&lt;/TargetFramework&gt;
      &lt;AzureFunctionsVersion&gt;v3-preview&lt;/AzureFunctionsVersion&gt;
    &lt;/PropertyGroup&gt;
    &lt;ItemGroup&gt;
      &lt;PackageReference Include="Microsoft.NET.Sdk.Functions" Version="1.0.30-beta2" /&gt;
      &lt;PackageReference Include="runtime.native.System.Data.SqlClient.sni" Version="4.6.0" /&gt;
      &lt;PackageReference Include="System.Data.SqlClient" Version="4.7.0" /&gt;
    &lt;/ItemGroup&gt;
    &lt;ItemGroup&gt;
      &lt;None Update="host.json"&gt;
        &lt;CopyToOutputDirectory&gt;PreserveNewest&lt;/CopyToOutputDirectory&gt;
      &lt;/None&gt;
      &lt;None Update="local.settings.json"&gt;
        &lt;CopyToOutputDirectory&gt;PreserveNewest&lt;/CopyToOutputDirectory&gt;
        &lt;CopyToPublishDirectory&gt;Never&lt;/CopyToPublishDirectory&gt;
      &lt;/None&gt;
    &lt;/ItemGroup&gt;
    &lt;!-- For publish --&gt;&lt;!--
    &lt;ItemGroup&gt;
      &lt;None Include="$(USERPROFILE)\.nuget\packages\\microsoft.data.sqlclient\1.0.19249.1\runtimes\win\lib\netcoreapp2.1\microsoft.Data.SqlClient.dll"&gt;
        &lt;CopyToOutputDirectory&gt;Always&lt;/CopyToOutputDirectory&gt;
      &lt;/None&gt;
    &lt;/ItemGroup&gt;
    --&gt;&lt;!-- For local debug --&gt;&lt;!--
    &lt;Target Name="CopyToBin" BeforeTargets="Build"&gt;
      &lt;Copy SourceFiles="$(USERPROFILE)\.nuget\packages\microsoft.data.sqlclient\1.0.19249.1\runtimes\win\lib\netcoreapp2.1\microsoft.Data.SqlClient.dll" DestinationFolder="$(OutputPath)\bin" /&gt;
    &lt;/Target&gt;--&gt;
  
    &lt;ItemGroup&gt;
      &lt;None Include="$(USERPROFILE)\.nuget\packages\\system.data.sqlclient\4.7.0\runtimes\win\lib\netcoreapp2.1\system.Data.SqlClient.dll"&gt;
        &lt;CopyToOutputDirectory&gt;Always&lt;/CopyToOutputDirectory&gt;
      &lt;/None&gt;
    &lt;/ItemGroup&gt;
    &lt;Target Name="CopyToBin" BeforeTargets="Build"&gt;
      &lt;Copy SourceFiles="$(USERPROFILE)\.nuget\packages\system.data.sqlclient\4.7.0\runtimes\win\lib\netcoreapp2.1\system.Data.SqlClient.dll" DestinationFolder="$(OutputPath)\bin" /&gt;
    &lt;/Target&gt;
  
  &lt;/Project&gt;
  </code></pre>