Powershell 和 TFS:tf.exe 与 Power tools TFS cmdlet 对比?
我正在创建一个脚本来在我的 TFS 实例中执行大量移动。我有 2010 TFS Power Tools 提供的 tfs cmdlet,但它们的获取帮助文档非常稀疏。具体来说,Add-TfsPendingChange 似乎不支持重命名,这迫使我改用“tf.exe rename”。
首先:我是否错过了 cmdlet 的文档?我已经尝试过在命令上获取帮助,但它们不支持 -detailed 或 -examples 标志。还有什么可用的吗?
其次:为什么我必须选择任何 cmdlet 而不是常规 tf.exe?在执行类似功能时,除了通过管道传递对象之外还有其他好处吗?
I'm in the middle of creating a script to do large amount of moves in my TFS instance. I have the tfs cmdlets available with the 2010 TFS Power Tools, but the get-help documentation for them is very sparse. Specifically, Add-TfsPendingChange doesn't seem to support rename, which forces me to use "tf.exe rename" instead.
First off: have I somehow missed the documentation for the cmdlets? I've tried get-help on the commands, but they don't support -detailed or -examples flags. Is anything more available?
Secondly: what reason do I have to prefer any of the cmdlets over regular tf.exe? Are there benefits other than passing objects through the pipe when performing similar functions?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
目前,TF cmdlet 是一种简约的产品,其中包括提供的文档。一般来说,我会使用 TF cmdlet,它们支持我想要做的事情 - 特别是如果您有任何疑问。处理查询 cmdlet 的输出要容易得多,因为它们为您提供丰富的对象,而不是在使用诸如 tf status 之类的内容时必须解析的文本流。 /r。
另请记住,在 x64 Windows 系统上,TF cmdlet 仅适用于 32 位 PowerShell 主机。
The TF cmdlets are a bit of a minimalistic offering at this point and that includes the provided documentation. In general I would use the TF cmdlets where they support what I'm trying to do - especially if you have any queries. Processing the output of the query cmdlets is much easier because they give you rich objects instead of the text stream you have to parse when using something like
tf status . /r
.Also keep in mind that on a x64 Windows system, the TF cmdlets only work in a 32-bit PowerShell host.
tf cmdlet 并不是完全无用,但是......我们决定现在不尝试在我们的构建环境中使用它们,即使这意味着文本解析。
除了 x64 之外,还有很多缺少命令(感谢@Keith)和缺少参数,并且最重要的是,它们在远程会话中不起作用!
The tf cmdlets are not exactly useless, but ... we decided against trying to use them in our build environment right now, even though it means text-parsing.
Aside from the x64 thing, there are lots of missing commands (thanks @Keith) and missing parameters, and most importantly, they don't work in remote sessions!
第三种选择是使用 PowerShell 中的 TFS 公共程序集。执行此操作时,您可以访问所有 TFS 客户端功能,并且仍然可以使用 TFS cmdlet。您是否选择此方法而不是 tf.exe 和其他 TFS 命令行可执行文件取决于您喜欢哪种脚本编写环境。
以下是引用 TFS 2013 公共程序集的 PowerShell 命令(对于 TFS 2012 或 2010,只需将
Version=12.0.0.0
更改为Version=11.0.0.0
或Version =10.0.0.0
)。对于重命名示例,您可以:
Get-TfsWorkspace
cmdlet 实例化Microsoft.TeamFoundation.VersionControl.Client.Workspace
对象。Workspace
对象的 PendRename,GetPendingChanges 和 签入方法。像这样的事情:
A third option is to use the TFS public assemblies from within PowerShell. When you do this, you can access all TFS client capabilities and still use TFS cmdlets as well. Whether you choose this approach over
tf.exe
and the other TFS command-line executables depends on which scripting environment you prefer.Here is a a PowerShell command to reference the TFS 2013 public assemblies (for TFS 2012 or 2010 just change
Version=12.0.0.0
toVersion=11.0.0.0
orVersion=10.0.0.0
).For your renaming example, you could then:
Get-TfsWorkspace
cmdlet to instantiate aMicrosoft.TeamFoundation.VersionControl.Client.Workspace
object.Workspace
object's PendRename, GetPendingChanges and Checkin methods.Something like this: