【问题标题】:Building .NET Standard and asp.net core together一起构建 .NET Standard 和 asp.net core
【发布时间】:2020-05-09 10:54:39
【问题描述】:

我有一个带有 asp.net core 3.1 和一些 .net 2.0 标准库的小型解决方案。我的管道失败并显示以下内容:

[错误]C:\Program Files\dotnet\sdk\3.1.201\Microsoft.Common.CurrentVersion.targets(3032,5): 错误 MSB4216:无法运行“GenerateResource”任务,因为 MSBuild 无法使用运行时“CLR4”创建或连接到任务主机 和架构“x86”。请确保 (1) 请求的运行时 和/或架构在机器上可用,并且 (2) 所需的可执行文件“C:\Program Files\dotnet\sdk\3.1.201\MSBuild.exe” 存在并且可以运行。

这是我的管道:

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'

难道不能建立这个吗?

【问题讨论】:

  • 您可以尝试在不使用 nuget restore 的情况下将 / t: Restore 添加到 dotnet 构建任务中的参数。或者尝试类似 case 中的解决方法。

标签: asp.net-core azure-devops azure-pipelines .net-standard


【解决方案1】:

这是由于解决方案中的一个 windows 窗体项目。

【讨论】:

  • 感谢您在这里分享您的解决方案,您能接受它作为答案吗?因此,对于遇到相同问题的其他成员轻松找到解决方案将很有帮助。祝你有美好的一天:)
  • 那么你对那个项目做了什么?
猜你喜欢
  • 2020-03-20
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2018-10-16
相关资源
最近更新 更多