一起构建 .NET Standard 和 asp.net 核心

Building .NET Standard and asp.net core together

我有一个带有 asp.net 核心 3.1 和一些 .net 2.0 标准库的小型解决方案。我的管道失败并出现以下情况:

[error]C:\Program Files\dotnet\sdk.1.201\Microsoft.Common.CurrentVersion.targets(3032,5): Error MSB4216: Could not run the "GenerateResource" task because MSBuild could not create or connect to a task host with runtime "CLR4" and architecture "x86". Please ensure that (1) the requested runtime and/or architecture are available on the machine, and (2) that the required executable "C:\Program Files\dotnet\sdk.1.201\MSBuild.exe" exists and can be run.

这是我的管道:

trigger:
- none

pool:
  vmImage: 'windows-latest'

variables:
  solution: 'Frontend/VendorFormAPI/VendorFormAPI.sln'
  buildPlatform: 'Any CPU'
  buildConfiguration: 'Release'

steps:

- task: NuGetCommand@2
  inputs:
    command: 'restore'
    restoreSolution: '$(solution)'
    feedsToUse: 'select'

- task: DotNetCoreCLI@2
  displayName: 'Building solution'
  inputs:
    command: 'build'
    projects: '$(solution)'

- task: DotNetCoreCLI@2
  displayName: 'Publish project'
  inputs:
    command: 'publish'
    publishWebProjects: true
    arguments: '--configuration $(BuildConfiguration) --output $(Build.ArtifactStagingDirectory)'
    projects: '$(solution)'

- task: PublishBuildArtifacts@1
  displayName: 'Drop artifacts to container'
  inputs:
    PathtoPublish: '$(Build.ArtifactStagingDirectory)'
    ArtifactName: 'drop'
    publishLocation: 'Container'

这个不能建吗?

这是由于解决方案中有一个 windows 表单项目。