Search code examples
asp.net-coreazure-devopsazure-pipelines.net-standard

Building .NET Standard and asp.net core together


I have a small solution with a asp.net core 3.1 and some .net 2.0 standard libraries. My pipeline fails with following:

[error]C:\Program Files\dotnet\sdk\3.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\3.1.201\MSBuild.exe" exists and can be run.

This is my pipeline:

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'

Is it not possible to build this?


Solution

  • It was due to a windows form project in the solution.