Azure Function v2 .NET framework?

后端 未结 2 1149
轻奢々
轻奢々 2021-01-18 09:38

We currently have deployed a V1 Azure Function and are looking to upgrade this to V2[preview]. However I can\'t see any way to target .NET Framework 4.6.1 at the moment, onl

相关标签:
2条回答
  • 2021-01-18 09:59

    The Function Runtime in v2 only runs on .NET Core 2.0, so there is no way to target .NET Framework 4.6.1.

    0 讨论(0)
  • 2021-01-18 10:00

    Using Visual Studio 2017 Preview 2, I was able to create a 4.61 Azure Functions Library.

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

    My full csproj

    PLEASE NOTE (future readers) this is subject to change as time goes by and the "preview" becomes integrated into the "real" 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>
    
    0 讨论(0)
提交回复
热议问题