【问题标题】:How to install PowerShell commandlets for TFS on a machine with Visual Studio 2017如何在装有 Visual Studio 2017 的机器上为 TFS 安装 PowerShell commandlet
【发布时间】:2019-03-19 08:44:51
【问题描述】:

我有一些与 TFS 一起使用的 PowerShell 脚本。我曾经有一个安装了 PowerTools 的 Visual Studio 2015,所以工作正常。

我现在有一台装有 Visual Studio 2017 的新机器,但我无法使用 PowerTools 部署安装命令行开关。我有哪些选择?

安装 VS 2015 对我来说不是一个选项(也不是长期解决方案)。

我试过了:

Add-PSSnapin Microsoft.TeamFoundation.PowerShell

但收到未安装 Microsoft.TeamFoundation.PowerShell 的错误。 尝试安装,提示找不到模块。

 Install-Module  Microsoft.TeamFoundation.PowerShell

有没有办法在不安装 VS 2015 的情况下安装它?

【问题讨论】:

    标签: powershell tfs


    【解决方案1】:

    您只能在没有 VS 2015 的情况下使用 Chocolatey 安装 TFS Power Tools cmdlet:

    1. 打开 PowerShell。
    2. Chocolatey - 必须存在于机器上,如果你没有它运行这个:

      Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))

    3. 下载 TFS 电动工具安装程序:Invoke-WebRequest -OutFile Install-TFPT.ps1 https://gist.githubusercontent.com/jrotello/2b9cd552e764e1cf364a3535b1dcc315/raw/Install-TFPT.ps1

    4. 安装 PowerShell cmdlet:./Install-TFPT.ps1 -InstallDirectory <installPath>

    5. 成功执行安装脚本后,您可以使用以下命令将 PowerShell 管理单元加载到您的会话中,或者将该命令添加到您的 PowerShell 配置文件中,以便将管理单元加载到您创建的每个 PowerShell 会话中。 Add-PSSnapin Microsoft.TeamFoundation.PowerShell

    您可以通过另一种方式找到here

    此外,您还可以下载Leon Jalfon 的另一个 TFS PowerShell 模块,其中包含许多有用的命令:

    https://github.com/leonjalfon1/tfs-powershell-module

    【讨论】:

      【解决方案2】:

      据我所知,没有适用于 TFS 2017 的 PowerTools。您可以阅读有关 TFS 2017 的 releases notes,但我不知道有关 Visual Studio 2017 的信息。

      但是,存在来自 Igor Avade (Github account) 的 repo。他有一个公共存储库:

      https://github.com/igoravl/tfscmdlets.

      你可以试试这个。

      (我之前没试过)。

      【讨论】:

        猜你喜欢
        • 2018-12-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2011-02-05
        • 2019-09-04
        • 2011-06-10
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多