我有一个C项目,它有cpprestsdk和libpqxx作为它的依赖项,我使用vcpkg作为我的包管理器。
我创建了一个Azure DevOps管道,它使用CppBuildTask任务从vcpkg克隆和构建依赖项,这工作正常,所有依赖项都成功提取和构建,但我不确定如何使用 *.vcxproj文件实际构建项目。
我尝试使用Visual Studio Build任务,但构建失败,因为它找不到CppBuildTask刚刚下载的依赖项。
尝试在Azure DevOps上使用vcpkg构建MSVC项目时,正确的任务是什么?
编辑管道yaml文件:
pool:
name: Azure Pipelines
demands:
- msbuild
- visualstudio
steps:
- task: Cache@2
displayName: Cache
inputs:
key: '$(Build.SourcesDirectory)/response_file.txt | 5951e0b42569257f97a5d9ac2d8c5bd4942c417b | x64-windows'
path: '$(Build.SourcesDirectory)/vcpkg'
- task: lucappa.cmake-ninja-vcpkg-tasks.d855c326-b1c0-4d6f-b1c7-440ade6835fb.run-vcpkg@0
displayName: 'Run vcpkg'
inputs:
vcpkgDirectory: '$(Build.SourcesDirectory)/vcpkg'
vcpkgGitCommitId: 5951e0b42569257f97a5d9ac2d8c5bd4942c417b
vcpkgArguments: '@$(Build.SourcesDirectory)/response_file.txt'
cleanAfterBuild: false
- task: VSBuild@1
displayName: 'Build solution TileServer\TileServer.vcxproj'
inputs:
solution: '$(Parameters.solution)'
platform: '$(BuildPlatform)'
configuration: '$(BuildConfiguration)'
msbuildArchitecture: x64
- task: PublishSymbols@2
displayName: 'Publish symbols path'
inputs:
SearchPattern: '**\bin\**\*.pdb'
IndexSources: false
PublishSymbols: false
continueOnError: true
- task: CopyFiles@2
displayName: 'Copy Files to: $(build.artifactstagingdirectory)'
inputs:
Contents: |
**\bin\$(BuildConfiguration)\**
.\Renderer\Styles\Themes\DefaultTheme.json
.\TileServer\glew32.dll
.\TileServer\ReleaseSettings.json
TargetFolder: '$(build.artifactstagingdirectory)'
condition: succeededOrFailed()
- task: PublishBuildArtifacts@1
displayName: 'Publish Artifact'
inputs:
PathtoPublish: '$(build.artifactstagingdirectory)'
ArtifactName: TileServer
condition: succeededOrFailed()
字符串
1条答案
按热度按时间gg58donl1#
在运行install命令后,通过显式集成vcpkg,我能够使vcpkg正常工作。在
run-vcpkg
任务之后添加这个,应该可以修复它:字符串