Azure functions 如何在macOS上运行Azure Functions 3.0

Azure functions 如何在macOS上运行Azure Functions 3.0,azure-functions,Azure Functions,我已经开始了一个简单的项目,在那里我连接到我的数据库并发送一些电子邮件。本地运行(macOS)只能在旧版本上运行,而不能在生产环境下运行。如果我升级软件包,它将在本地停止工作,但它将在生产上工作 生产中的旧包我得到以下错误 System.Data.SqlClient is not supported on this platform Value cannot be null. Parameter name: provider Could not load file or assembly '

我已经开始了一个简单的项目,在那里我连接到我的数据库并发送一些电子邮件。本地运行(macOS)只能在旧版本上运行,而不能在生产环境下运行。如果我升级软件包,它将在本地停止工作,但它将在生产上工作

生产中的旧包我得到以下错误

System.Data.SqlClient is not supported on this platform
Value cannot be null.
Parameter name: provider

Could not load file or assembly 'Microsoft.Extensions.DependencyInjection.Abstractions, Version=3.1.2.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. The system cannot find the file specified.
本地服务器上的新软件包出现以下错误

System.Data.SqlClient is not supported on this platform
Value cannot be null.
Parameter name: provider

Could not load file or assembly 'Microsoft.Extensions.DependencyInjection.Abstractions, Version=3.1.2.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. The system cannot find the file specified.
旧版本

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <TargetFramework>netcoreapp2.1</TargetFramework>
    <AzureFunctionsVersion>v2</AzureFunctionsVersion>
  </PropertyGroup>
  <ItemGroup>
    <PackageReference Include="ably.io" Version="1.1.18" />
    <PackageReference Include="Microsoft.Azure.Functions.Extensions" Version="1.0.0" />
    <PackageReference Include="Microsoft.NET.Sdk.Functions" Version="1.0.29" />
    <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="2.2.3" />
    <PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="2.2.3">
      <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
      <PrivateAssets>all</PrivateAssets>
    </PackageReference>
  </ItemGroup>
</Project>
。。。但当我运行项目时,它显示

Azure Functions Core Tools (2.7.1948 Commit hash: 29a0626ded3ae99c4111f66763f27bb9fb564103)
Function Runtime Version: 2.0.12888.0
我的创业班

public class Startup : FunctionsStartup
    {
        public override void Configure(IFunctionsHostBuilder builder)
        {
            string connection = Environment.GetEnvironmentVariable("SqlConnectionString");

            builder.Services.AddDbContext<BaseContext>(options => options.UseSqlServer(connection));
        }
    }
公共类启动:函数启动
{
公共覆盖无效配置(IFunctionsHostBuilder)
{
字符串连接=Environment.GetEnvironmentVariable(“SqlConnectionString”);
builder.Services.AddDbContext(options=>options.UseSqlServer(connection));
}
}
我会错过什么


这是macOS的问题吗?

首先,您应该将Microsoft.EntityFrameworkCore.SqlServer更新到3.1版。这不再依赖于System.Data.SqlClient,也不再依赖于Microsoft.NET.Sdk.3.0的函数。5@silent哦,对不起,我刚刚通过了问题中的错误版本。要明确的是,在新版本中,它都是更新的。但是,您的依赖项仍然存在一些问题。3.x EF Core软件包不再依赖System.Data.SqlClient。如果我能给你一个建议,我希望有人能给我安装Intellij Rider(使用Azure工具包)和ditch VS。这简直太棒了!