System.Data.SqlClient Azure 函数中的 4.6.0
System.Data.SqlClient 4.6.0 in Azure Functions
我目前在我的 Azure Functions 中使用 System.Data.SqlClient 4.5.1,但我想使用 4.6.0,因为它支持访问令牌。我相信,最后两个预览版也支持访问令牌。该功能已于 6 月提交给 .NET Core 存储库。我不确定 NuGet 包和 .NET Core Framework 本身之间有什么区别。用于调试的 Azure Functions 本地运行时声称该平台不支持 4.6.0 或预览版。有什么想法吗?
与运行时程序集相关的引用似乎有些问题,请查看此 issue。
因此解决方法是自行加载程序集。右键单击函数项目并Edit <FunctionAppName>.csproj
,在下面添加项目以将相关程序集复制到输出目录。
<!-- For publish -->
<ItemGroup>
<None Include="$(USERPROFILE)\.nuget\packages\system.data.sqlclient.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.6.0\runtimes\win\lib\netcoreapp2.1\System.Data.SqlClient.dll" DestinationFolder="$(OutputPath)\bin" />
</Target>
我目前在我的 Azure Functions 中使用 System.Data.SqlClient 4.5.1,但我想使用 4.6.0,因为它支持访问令牌。我相信,最后两个预览版也支持访问令牌。该功能已于 6 月提交给 .NET Core 存储库。我不确定 NuGet 包和 .NET Core Framework 本身之间有什么区别。用于调试的 Azure Functions 本地运行时声称该平台不支持 4.6.0 或预览版。有什么想法吗?
与运行时程序集相关的引用似乎有些问题,请查看此 issue。
因此解决方法是自行加载程序集。右键单击函数项目并Edit <FunctionAppName>.csproj
,在下面添加项目以将相关程序集复制到输出目录。
<!-- For publish -->
<ItemGroup>
<None Include="$(USERPROFILE)\.nuget\packages\system.data.sqlclient.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.6.0\runtimes\win\lib\netcoreapp2.1\System.Data.SqlClient.dll" DestinationFolder="$(OutputPath)\bin" />
</Target>