我只是想看看使用PowerShell的路径,并检查在这条道路一分钟后在Team Foundation Server中。
我怎样才能做到这一点?
我已经安装了TFS电动工具在我的服务器。
我只是想看看使用PowerShell的路径,并检查在这条道路一分钟后在Team Foundation Server中。
我怎样才能做到这一点?
我已经安装了TFS电动工具在我的服务器。
你不需要的电动工具。 只需使用tf.exe命令生产线使用率随Visual Studio和TFS团队资源管理器。 tf edit <file> /noprompt
退房和tf checkin <file> /comment:$comment /noprompt
。在检查只看tf.exe的命令行用法的更多信息tf /?
和tf checkin /?
。 您将需要一起tf.exe路径配置PowerShell会话。 这通常是由VS瓦尔批处理文件来完成。 但是,你应该能够简单地添加到路径,像这样: $PATH += "${VS110COMNTOOLS}..\Ide"
这里是一个将检查是否安装了管理单元的功能。 如果你安装了电动工具,它使用的,否则,它使用命令行工具tf.exe
function checkout-file([string] $file)
{
"Checking out $file"
if ((Get-PSSnapin -Name Microsoft.TeamFoundation.PowerShell -ErrorAction SilentlyContinue) -eq $null )
{
Add-PsSnapin Microsoft.TeamFoundation.PowerShell -ErrorAction SilentlyContinue
if ((Get-PSSnapin -Name Microsoft.TeamFoundation.PowerShell -ErrorAction SilentlyContinue) -eq $null )
{
#try to check out the code using command line tf.exe
&"C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\TF.exe" checkout $file | Out-Null
}
else{
#checkout the file using snapin
Add-TfsPendingChange -Edit $file | Out-Null
}
}else{
#checkout the file using snapin
Add-TfsPendingChange -Edit $file | Out-Null
}
}
如果您已经安装了PowerShell中的电动工具命令行开关。 像Kieth提到,在命令行开关别名TF为全tf.exe路径的一部分,你并不需要的路径。 所以,简单地使用tf.exe命令行参考这里 ,所有的这些,如果你有正确安装PowerShell的命令行开关应该工作。
你应该确保你的PowerShell有他们虽然通过使用该命令安装
Add-PSSnapin Microsoft.TeamFoundation.PowerShell
这是我的解决方案:
$tf = &"C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\tf.exe" checkout C:\setup\folder /recursive
$tf | Out-null
另一种选择是,如果你想处理在同一命令多个文件,无需拿起其他文件或遍历他们使用的外卡。
tf.exe undo AssemblyInfo* /recursive
tf.exe checkout AssemblyInfo* /recursive
#changes files
tf.exe checkin AssemblyInfo* /recursive