【发布时间】: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