为 .Net 5 构建时,DevOps 构建找不到 NetCore.App
DevOps Build Can't Find NetCore.App when building for .Net 5
我正在尝试 运行 第一次为 dotnet 5 构建 devops。
这是我的构建管道:
variables:
buildPlatform: 'Any CPU'
buildConfiguration: 'Debug'
projects: '**/Interfaces.Avaloq.BamApi.AzFunc.csproj'
stages:
- stage: A
pool:
name: Hosted Windows 2019 with VS2019
demands:
- msbuild
- visualstudio
jobs:
- job: Build
continueOnError: true
steps:
- task: UseDotNet@2
displayName: 'Install .Net Core SDK'
inputs:
packageType: 'sdk'
version: '5.0.100'
- script: |
- task: DotNetCoreCLI@2
displayName: Restore Functions
inputs:
command: restore
projects: '$(projects)'
feedsToUse: config
nugetConfigPath: nuget.config
- task: DotNetCoreCLI@2
displayName: Build Functions
inputs:
command: build
projects: '$(projects)'
arguments: '--configuration $(buildConfiguration)'
- task: DotNetCoreCLI@2
displayName: Publish
inputs:
command: publish
arguments: '--configuration $(buildConfiguration) --output $(build.artifactstagingdirectory)'
projects: '$(projects)'
publishWebProjects: false
zipAfterPublish: true
这是它试图构建的 cs 项目“Interfaces.Avaloq.BamApi.AzFunc.csproj”:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<AzureFunctionsVersion>v3</AzureFunctionsVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Sdk.Functions" Version="3.0.7" />
</ItemGroup>
<ItemGroup>
<None Update="host.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="local.settings.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<CopyToPublishDirectory>Never</CopyToPublishDirectory>
</None>
</ItemGroup>
</Project>
dotnet restore 工作正常,但对于构建任务,我收到以下错误:
Error : It was not possible to find any compatible framework version
The framework 'Microsoft.NETCore.App', version '3.0.0' was not found.
- The following frameworks were found:
5.0.0 at [C:\hostedtoolcache\windows\dotnet\shared\Microsoft.NETCore.App]
我不明白它为什么要查找 v3?
Azure Functions 似乎要到 2020 年底才会支持 dotnet 5。详情请见:https://github.com/Azure/azure-functions-host/issues/6674
我正在尝试 运行 第一次为 dotnet 5 构建 devops。
这是我的构建管道:
variables:
buildPlatform: 'Any CPU'
buildConfiguration: 'Debug'
projects: '**/Interfaces.Avaloq.BamApi.AzFunc.csproj'
stages:
- stage: A
pool:
name: Hosted Windows 2019 with VS2019
demands:
- msbuild
- visualstudio
jobs:
- job: Build
continueOnError: true
steps:
- task: UseDotNet@2
displayName: 'Install .Net Core SDK'
inputs:
packageType: 'sdk'
version: '5.0.100'
- script: |
- task: DotNetCoreCLI@2
displayName: Restore Functions
inputs:
command: restore
projects: '$(projects)'
feedsToUse: config
nugetConfigPath: nuget.config
- task: DotNetCoreCLI@2
displayName: Build Functions
inputs:
command: build
projects: '$(projects)'
arguments: '--configuration $(buildConfiguration)'
- task: DotNetCoreCLI@2
displayName: Publish
inputs:
command: publish
arguments: '--configuration $(buildConfiguration) --output $(build.artifactstagingdirectory)'
projects: '$(projects)'
publishWebProjects: false
zipAfterPublish: true
这是它试图构建的 cs 项目“Interfaces.Avaloq.BamApi.AzFunc.csproj”:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<AzureFunctionsVersion>v3</AzureFunctionsVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Sdk.Functions" Version="3.0.7" />
</ItemGroup>
<ItemGroup>
<None Update="host.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="local.settings.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<CopyToPublishDirectory>Never</CopyToPublishDirectory>
</None>
</ItemGroup>
</Project>
dotnet restore 工作正常,但对于构建任务,我收到以下错误:
Error : It was not possible to find any compatible framework version The framework 'Microsoft.NETCore.App', version '3.0.0' was not found.
- The following frameworks were found: 5.0.0 at [C:\hostedtoolcache\windows\dotnet\shared\Microsoft.NETCore.App]
我不明白它为什么要查找 v3?
Azure Functions 似乎要到 2020 年底才会支持 dotnet 5。详情请见:https://github.com/Azure/azure-functions-host/issues/6674