我试图弄清楚如何在构建过程中关闭循环,在构建过程中,我们将版本号应用于AssemblyInfo。*文件。
我们正在从本地tfs迁移到Visual Studio团队服务。我们当前的许多内部部署版本都会更新版本号,以使其与版本号保持同步,并在构建过程中将这些文件重新签入源代码管理。
我现在正尝试将文件检回到源代码管理中,但收到错误消息:
#[error]TF30063: You are not authorized to access https://subdomain.visualstudio.com/DefaultCollection.
#[error]Process completed with exit code 100 and had 1 error(s) written to the error stream.
我目前正在使用tf.exe尝试执行此操作。首先,在Powershell脚本顶部获取该工具的路径;
# get the tf command line tool path
$tfexe = [System.IO.Path]::GetFullPath($env:VS140COMNTOOLS + "..\..\common7\ide\tf.exe")
if (-Not (Test-Path $tfexe))
{
Write-Error "Could not find tf.exe at '$tfexe'"
exit 1
}
else
{
Write-Host "Found tf.exe at '$tfexe'"
}
然后修改循环以检出文件,然后将文件检回。
# Apply the version to the assembly property files
$files = gci $Env:BUILD_SOURCESDIRECTORY -recurse -include "*Properties*","My Project" |
?{ $_.PSIsContainer } |
foreach { gci -Path $_.FullName -Recurse -include AssemblyInfo.* }
if($files)
{
Write-Host "Will apply $NewVersion to $($files.count) files."
foreach ($file in $files) {
#Write-Host "Attempting to checkout file '$file'"
& ($tfexe) vc checkout $file
$filecontent = Get-Content($file)
attrib $file -r
$filecontent -replace $VersionRegex, $NewVersion | Out-File $file
Write-Host "$file.FullName - version applied"
}
# Checkin pending changes together
##[error]TF30063: You are not authorized to access https://subdomain.visualstudio.com/DefaultCollection.
##[error]Process completed with exit code 100 and had 1 error(s) written to the error stream.
Write-Host "Attempting to checkin files"
$comment = "Applied $NewVersion to $($files.count) files. ***NO_CI***"
& ($tfexe) vc checkin /comment:"$comment" /noprompt
}
这是执行此操作的正确方法吗?如果未授权构建服务访问,那么该如何获取代码,对其进行编译,然后将工件发布到某个地方?
我不建议每次都签入程序集版本,而是建议使用[assembly: AssemblyVersion("1.2.*")]
通配符支持(并且我删除了通配符支持,[AssemblyFileVersion]
以便它自动匹配。
生成后签入更改的文件存在多种方式的问题:
**NO_CI**
变更集我创建了一个新的构建任务,该任务将允许您使用任务检入文件:
使用tfx
控制台将其添加到visualstudio团队基础服务或TFS 2015实例:
tfx build tasks upload -taskpath path\to\project\root
我仍在研究添加和删除的方法,但是我遇到了客户端对象模型的问题,除了编辑之外,它不进行任何处理。
它看起来像是调用,tf add
并且tf delete
实际上将与此签入任务结合在构建脚本中工作。
想要查询更多的信息:
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句