【问题标题】:Azure Function v2 .NET framework?Azure Function v2 .NET 框架?
【发布时间】:2018-04-30 23:12:32
【问题描述】:

我们目前已经部署了 V1 Azure Function,并希望将其升级到 V2[预览版]。但是我目前看不到任何针对 .NET Framework 4.6.1 的方法,只有在创建 v2 函数时才能使用 .NET Core。

是否可以在 Azure Function v2 中使用 .NET Framework?

【问题讨论】:

    标签: azure azure-functions


    【解决方案1】:

    v2 中的 Function Runtime 仅在 .NET Core 2.0 上运行,因此无法针对 .NET Framework 4.6.1。

    【讨论】:

      【解决方案2】:

      使用 Visual Studio 2017 Preview 2,我能够创建一个 4.61 Azure Functions 库。

      <PropertyGroup>
          <TargetFramework>net461</TargetFramework>
        </PropertyGroup>
      

      我的完整csproj

      请注意(未来的读者)这可能会随着时间的推移而发生变化,并且“预览”将集成到“真实”VS2017 中。

      <Project Sdk="Microsoft.NET.Sdk">
        <PropertyGroup Label="Globals">
          <SccProjectName>SAK</SccProjectName>
          <SccProvider>SAK</SccProvider>
          <SccAuxPath>SAK</SccAuxPath>
          <SccLocalPath>SAK</SccLocalPath>
        </PropertyGroup>
        <PropertyGroup>
          <TargetFramework>net461</TargetFramework>
        </PropertyGroup>
        <ItemGroup>
          <PackageReference Include="Microsoft.Azure.WebJobs" Version="2.1.0-beta1" />
          <PackageReference Include="Microsoft.Azure.WebJobs.Extensions" Version="2.1.0-beta1" />
          <PackageReference Include="Microsoft.Azure.WebJobs.Extensions.Http" Version="1.0.0-beta1" />
          <PackageReference Include="Microsoft.Azure.WebJobs.ServiceBus" Version="2.1.0-beta1" />
          <PackageReference Include="Newtonsoft.Json" Version="10.0.2" />
          <PackageReference Include="Microsoft.NET.Sdk.Functions" Version="1.0.0-alpha3" />
          <PackageReference Include="Newtonsoft.Json.Schema" Version="3.0.2" />
          <PackageReference Include="System.Runtime.InteropServices.RuntimeInformation" Version="4.3.0" />
          <PackageReference Include="Unity" Version="4.0.1" />
        </ItemGroup>
        <ItemGroup>
          <Reference Include="Microsoft.CSharp" />
          <Reference Include="System.Configuration" />
          <Reference Include="System.Web" />
        </ItemGroup>
        <ItemGroup>
          <None Update="host.json">
            <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
          </None>
          <None Update="local.settings.json">
            <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
          </None>
        </ItemGroup>
      </Project>
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2019-05-08
        • 2023-03-03
        • 1970-01-01
        • 2019-10-08
        • 1970-01-01
        • 2020-04-09
        • 1970-01-01
        • 2020-10-25
        相关资源
        最近更新 更多