Azure Functions v2从.Net Standard更改为.Net Core [英] Azure Functions v2 changed from .Net Standard to .Net Core

查看:324
本文介绍了Azure Functions v2从.Net Standard更改为.Net Core的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

上个月我一直在使用Azure Functions,并且很高兴将它们创建为V2(.Net标准)

I have been using Azure Functions for the last month and have been happily creating them as V2 (.Net Standard)

现在,在最近一次更新之后,我只能将V2创建为(.Net Core),而这些似乎与旧类型不兼容.

Now after the most recent update I can only create V2 as (.Net Core), and these don't seem to be compatible with the old type.

我真的需要将所有旧功能移植到这种新类型中吗?这是我尝试在旧函数中引用新函数时遇到的错误.

Do I really need to port all my old functions into this new type? This is the error I get when trying to reference a new function in an old function.

Project is not compatible with netstandard2.0 (.NETStandard,Version=v2.0). Project supports: netcoreapp2.0 (.NETCoreApp,Version=v2.0)

两个V2项目并排的截图.

推荐答案

目前,netstandard2.0(很长时间以来的旧模板)和netcoreapp2.1(几天前已更新)目标框架都可以正常工作.函数运行时2.x​​从一开始就基于.Net Core env,因此,此TF更改不应影响以前构建的功能,只需提供对.Net Core API和相关依赖项的访问即可.

For now, netstandard2.0(old template for a long time) and netcoreapp2.1(updated several days ago) target framework both work. The function runtime 2.x is based on .Net Core env from the very beginning so this TF change should have no effect on functions built before, just offer access to .Net Core APIs and related dependencies.

但是我们不能引用针对不同框架的项目,我们必须更改TF才能实现兼容性.右键单击项目和Edit <FunctionProjectName>.csproj.

But we can't reference projects targeting at different framework, we have to change TF to achieve compatibility. Right click on project and Edit <FunctionProjectName>.csproj.

请参阅新模板中的默认TF. (将VS更新到最新的15.8.8,以使用最新的.Net Core 2.1.)

See default TF in new template. (Update VS to latest 15.8.8 to consume latest .Net Core 2.1.)

<PropertyGroup>
    <TargetFramework>netcoreapp2.1</TargetFramework>
    <AzureFunctionsVersion>v2</AzureFunctionsVersion>
  </PropertyGroup>

我们可以将新项目修改回TF netstandard2.0,但是为了长期兼容,我建议将旧项目更新为netcoreapp2.1.记得在旧项目中将Microsoft.NET.Sdk.Functions更新为1.0.*(即最新版本).

We can modify new project back to TF netstandard2.0, but I recommend to update old projects to netcoreapp2.1 for long term compatibility. Remember to update Microsoft.NET.Sdk.Functions to 1.0.*(i.e. the latest) in old projects.

这篇关于Azure Functions v2从.Net Standard更改为.Net Core的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆