Azure管道构建将TFVC项目引用引入git构建 [英] Azure pipeline build bring TFVC project references into git build
问题描述
我在azure存储库中有一个git解决方案,其中有对TFVC项目的三个项目引用.我现在正在尝试使用YAML创建构建管道,但是找不到从TFVC下载项目的任何步骤.这给了我这种错误:错误MSB3202:找不到项目文件(项目的路径)\ Standard.Logging.csproj"
我知道这是因为项目文件夹不是存储库的一部分,但是我不确定如何将它们从tfsvc存储库导入到我的构建代理中.
这是我的azure-pipelines.yml:
pool:'MyPool'变量:解决方案:"**/*.sln"buildPlatform:任何CPU"buildConfiguration:'发布'脚步:-任务:NuGetToolInstaller @ 1-任务:NuGetCommand @ 2输入:命令:恢复"restoreSolution:'$(解决方案)'feedsToUse:选择"vstsFeed:"{company feed}"-任务:VSBuild @ 1输入:解决方案:"$(solution)"msbuildArgs:'/p:DeployOnBuild = true/p:WebPublishMethod = Package/p:PackageAsSingleFile = true/p:SkipInvalidConfigurations = true/p:DesktopBuildPackageLocation="$(build.artifactStagingDirectory)\WebApp.zip平台:"$(buildPlatform)"配置:'$(buildConfiguration)'
我如何下载这些项目?
恐怕YAML管道当前不支持TFVC.
作为解决方法,您可以
在Yaml中支持TFVC的用户语音已提交给Microsoft开发.您可以投票或创建一个新的.请参见此处.
更新:
- 要将tfsvc存储库中的代码带入构建代理.
您可以使用TFVC 通过api获取项目休息信息以获取项目.在您的管道中添加脚本任务以调用其余的api并将项目保存在构建代理中.请检查以下有关powershell脚本的示例:获取个人访问令牌.请参考文档 上面的脚本调用Get Items Api并获取项目的url和路径( 然后获取每个项目并保存到 I have a git solution in azure repositories that has three project references to TFVC projects. I'm trying to create a build pipeline right now using YAML, but I can't find any step that downloads projects from TFVC. This is giving me this sort of error: I know this is because the project folders aren't part of the repository, but i'm not sure how to bring them from the tfsvc repo into my build agent. Here is my azure-pipelines.yml: How do I download these projects? I am afraid YAML pipeline doesnot support TFVC currently. As workaround you can migrate TFVC to Git. You can also create a classic UI build pipeline instead of YAML pipeline. TFVC is supported on classic UI pipeline. User voice to support TFVC in Yaml has been submitted to Microsoft development. You can vote it up or create a new one. see here. Update: you can use TFVC Get items rest api to get the items. Add a script task in your pipeline to call the rest api and save the items in the build agent. Please check about below example powershell script: To get a Personal access token. Please refer to document here. Above script call the Get Items Api and get the items url and path( Then get each item and save to 这篇关于Azure管道构建将TFVC项目引用引入git构建的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋! $ files = $ result.value |其中{!$ _.isFolder} |选择路径,URL
) $(System.DefaultWorkingDirectory)
.例如,如果我的scopePath是 $/MyProject/
,则项目将保存到 $(System.DefaultWorkingDirectory)/MyProject/
Error MSB3202: The project file "(path to project)\Standard.Logging.csproj" was not found
pool: 'MyPool'
variables:
solution: '**/*.sln'
buildPlatform: 'Any CPU'
buildConfiguration: 'Release'
steps:
- task: NuGetToolInstaller@1
- task: NuGetCommand@2
inputs:
command: 'restore'
restoreSolution: '$(solution)'
feedsToUse: 'select'
vstsFeed: '{company feed}'
- task: VSBuild@1
inputs:
solution: '$(solution)'
msbuildArgs: '/p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:DesktopBuildPackageLocation="$(build.artifactStagingDirectory)\WebApp.zip"
platform: '$(buildPlatform)'
configuration: '$(buildConfiguration)'
$url = "$(System.TeamFoundationCollectionUri)$(System.TeamProject)/_apis/tfvc/items?scopePath=path&recursionLevel=full&api-version=5.1"
$PAT= "Personal access token"
$base64AuthInfo= [System.Convert]::ToBase64String([System.Text.Encoding]::ASCII.GetBytes(":$($PAT)"))
$result = Invoke-RestMethod -Uri $url -Method Get -Header @{Authorization = "Basic $base64AuthInfo"}
$files= $result.value | where { !$_.isFolder} | select path, url
foreach($file in $files){
$path = "$(System.DefaultWorkingDirectory)\" + $file.path.Substring(2)
New-Item -Path $path -ItemType File -Force
Invoke-RestMethod -Uri $file.url -Method get -Header @{Authorization = "Bearer $env:SYSTEM_ACCESSTOKEN"} -OutFile $path
}
$files= $result.value | where { !$_.isFolder} | select path, url
)$(System.DefaultWorkingDirectory)
. For example if my scopePath is $/MyProject/
, then the items will be save to $(System.DefaultWorkingDirectory)/MyProject/