.NET 5

编程入门 行业动态 更新时间:2024-10-28 21:21:22
本文介绍了.NET 5 - 找不到框架“Microsoft.NETCore.App",版本“3.1.0"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

当使用 azure 管道构建我的 .NET 5 函数时,我收到以下错误

When using azure pipelines to build my .NET 5 function I am getting the following error

##[error]/home/vsts/.nuget/packages/microsoft.sdk.functions/3.0.11/build/Microsoft.NET.Sdk.Functions.Build.targets(32,5): Error : It was not possible to find any compatible framework version The framework 'Microsoft.NETCore.App', version '3.1.0' was not found. - The following frameworks were found: 5.0.4 at [/opt/hostedtoolcache/dotnet/shared/Microsoft.NETCore.App]

这还会在构建脚本的进一步下方显示 Error : Metadata generation failed 错误

This also displays a Error : Metadata generation failed error further down the build script

##[error]/home/vsts/.nuget/packages/microsoft.sdk.functions/3.0.11/build/Microsoft.NET.Sdk.Functions.Build.targets(32,5): Error : Metadata generation failed.

我的构建脚本是

trigger: - master stages: - stage: 'Build' jobs: - job: pool: vmImage: 'ubuntu-latest' workspace: clean: all steps: - task: UseDotNet@2 displayName: Use Dot Net Core 5.0.x inputs: packageType: 'sdk' version: '5.0.x' - task: DotNetCoreCLI@2 displayName: Build inputs: arguments: '--configuration Release' command: 'build' projects: '**/*.csproj'

推荐答案

要构建 .NET 5 函数,需要 .NET Core 3 SDK.所以这必须与 5.0.x sdk 一起安装.

To build .NET 5 functions, the .NET Core 3 SDK is required. So this must be installed alongside the 5.0.x sdk.

就我而言,这意味着脚本需要更新为

In my case it meant that the script needed to be updated to

trigger: - master stages: - stage: 'Build' jobs: - job: pool: vmImage: 'ubuntu-latest' workspace: clean: all steps: - task: UseDotNet@2 displayName: Use Dot Net Core 3.1.x inputs: packageType: 'sdk' version: '3.1.x' - task: UseDotNet@2 displayName: Use Dot Net Core 5.0.x inputs: packageType: 'sdk' version: '5.0.x' - task: DotNetCoreCLI@2 displayName: Build inputs: arguments: '--configuration Release' command: 'build' projects: '**/*.csproj'

更多推荐

.NET 5

本文发布于:2023-11-05 11:41:43,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1560745.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:NET

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!