【问题标题】:Azure pipeline missing referencesAzure 管道缺少引用
【发布时间】:2019-07-05 14:48:12
【问题描述】:

我正在尝试使用 Azure 管道来构建和发布我的项目。不幸的是,没有太多的文档或问答。

我的解决方案包含 12 个库,大多数使用 .net 核心/标准,一个使用 angular(但这不是问题)。在视觉工作室建筑/出版作品中。在我的 dev.azure 工作区中它没有。

这是我的 YAML 文件

trigger:
- master

pool:
  vmImage: 'windows-latest'

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

steps:
- task: NuGetToolInstaller@0

- task: NuGetCommand@2
  inputs:
    restoreSolution: '$(solution)'

- task: VSBuild@1
  inputs:
    solution: '$(solution)'
    msbuildArgs: '/p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:PackageLocation="$(build.artifactStagingDirectory)"'
    platform: '$(buildPlatform)'
    configuration: '$(buildConfiguration)'

- task: VSTest@2
  inputs:
    platform: '$(buildPlatform)'
    configuration: '$(buildConfiguration)'

问题是,在构建时所有引用都丢失了:

错误 CS0234:命名空间“Microsoft”中不存在类型或命名空间名称“AspNetCore”(您是否缺少程序集引用?)

有人知道如何解决这个问题吗? nuget 恢复工作。

【问题讨论】:

  • nuget restore 活动的输出说明了什么?
  • @DanielMann 没有警告/错误。一切正常。 Restore completed in 519.83 ms for d:\a\1\s.....\....csproj
  • @Stanley nope.. 公司项目花了我太长时间,所以我通过命令行发布并复制/粘贴到服务器。下周我将使用 .net 5 开始一个新的私人项目,所以我会再试一次,可能可以在这里更新:)
  • @MatthiasBurger 感谢您的更新,我的问题出在 ILoggerService 上,结果我的 git repo 有 .gitignor 日志……我花了大约 6 个小时才弄清楚。这篇文章很棒dev.to/lasanga/…
  • @Stanley 感谢这篇文章。是的,天蓝色的管道有时很复杂。虽然它在工作时很棒......

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


【解决方案1】:

这个问题看起来像依赖项失败。这应该是因为您的项目已经引用了依赖项,但在管道期间没有安装它们。

您可以尝试在调用VSBuild 任务之前先执行dotnet restore。

【讨论】:

  • 这会返回一个Cmd.exe exited with code '1'. 当它在一个角度网站项目中尝试这个时它会停止(当然,它不能用角度做这个),它不能跳过那个项目并继续其他项目吗?
  • dotnet restore task的日志中是否出现此错误信息?
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2020-12-21
  • 2016-05-21
  • 1970-01-01
  • 1970-01-01
  • 2021-03-28
  • 1970-01-01
相关资源
最近更新 更多