c# - 如何在 Azure DevOps 上构建 .NET 5 Azure Function?
问题描述
我正在尝试使用 yml 编辑器为 .NET 5 隔离进程 Azure 函数创建构建管道。我的步骤如下:
steps:
- task: NugetToolInstaller@1
displayName: 'NuGet Installer'
inputs:
versionSpec: $(NuGetVersion)
- task: UseDotNet@2
displayName: 'Using .NET $(NetVersion)'
inputs:
packageType: 'sdk'
version: $(NetVersion)
- task: DotNetCoreCLI@2
displayName: 'Building Solution'
inputs:
command: 'build'
arguments: '--configuration $(BuildConfiguration)'
projects: '$(Solution)'
- task: DotNetCoreCLI@2
displayName: 'Publish Function'
inputs:
command: 'publish'
publishWebProjects: true
arguments: '--output $(Build.ArtifactStagingDirectory) -c $(BuildConfiguration)'
modifyOutputPath: false
当我进入构建解决方案步骤时,它失败了,原因如下:
C:\SomeDirectory\.nuget\packages\microsoft.net.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.10 at [C:\somedirectory\].
You can resolve the problem by installing the specified framework and/or SDK.
然后它继续链接 .NET Core 3.1 运行时。我不确定为什么会这样。.csproj 指定了 .NET 5 以及 .sln 文件。我尝试使用 .sln 文件和 .csproj 文件进行构建。我没有在任何地方指定 .NET Core 3.1,相关的 NuGet 包都是最新的。
是否有我必须使用的某个步骤或我必须指定一些变量才能使其工作?
解决方案
推荐阅读
- python - LRU缓存使用多个键?
- node.js - 安装并要求 express-validator 后出现“TypeError:validator is not a function”
- regex - Rails 正则表达式排除符号结束单词之间的空格
- javascript - 如何在 react-native 组件中使用第三方 JS 库?
- javascript - 执行 splitter.refresh 后无法在 shieldSplitter 中初始化谷歌地图
- c# - 通过 cmd 行运行时未检测到使用 xunit 框架编写的 selenium 测试
- python-3.x - 是否有一个 python 函数可以让我获取一个主 CSV 文件并将其拆分为 100 行?
- botframework - 如何添加多个 ComponentDialogs?
- asp.net - 使用嵌套布局时,是否可以将使用 Razor 引擎的部分渲染委托给父布局?
- vba - 我试图在找到字符串后删除(用户确定的)数量的段落