使用Powershell绕过TFS门控签入
问题描述:
我正在开发自动化过程,涉及将某些数据文件签入到具有门控签入过程的构建中。在PowerShell中,我的代码在一起,就像这样:使用Powershell绕过TFS门控签入
$pendings = $ws.GetPendingChanges()
if($pendings.Count -gt 0)
{
$ws.CheckIn($pendings, $checkInComments);
}
此代码的功能完好,如果它是在手动检查的区域,我已经添加的所有的DLL等。但是,如果构建是门控,它失败了,有:
Exception calling "CheckIn" with "2" argument(s):
"Your check-in could not be completed because it affects the following gated build definitions.
我发现在C#中完成过这个问题下面的答案,但我似乎无法过来翻译成PowerShell的,据我所知,。如果我添加了适当的DLL,我应该可以使用网络方法。
var pendingChanges = workspace.GetPendingChanges();
if (pendingChanges.Any())
{
WorkspaceCheckInParameters parameters = new WorkspaceCheckInParameters(pendingChanges, BuildCommonUtil.NoCICheckInComment)
{
OverrideGatedCheckIn = true,
};
workspace.CheckIn(parameters);
}
有没有人有关于如何绕过闸门(权限假设)在Powershell的想法?
答
您可能尝试使用此设置时,您设置您的门控办理登机手续工作区。
- Microsoft.TeamFoundation.VersionControl.ClientCheckInParameters.OverrideGatedCheckIn物业
答
我检查所有在互联网上,PowerShell的文档,MSDN代码相当于提及 “OverrideGatedCheckIn = true
” 为PowerShell的而我发现的所有东西都在非工作状态下
Write-Host "tf.exe checkin"
& $tfexe checkin $wsp /comment:"***NO_CI***"
/bypass /noprompt /recursive /override:"Auto-Build: Version Update" | Out-Null
解决方案
所以,我对这个问题的解决方案是移动集版本的文件(AssemblyInfo.vb中& AssemblyInfo.cs中)到一个名为SharedAssembly文件夹,并将其排除在考虑为GatedCheck,在过程。