Skip to content

Install-TfsShell & Uninstall-TfsShell #101

@igoravl

Description

@igoravl

Add cmdlets to install/uninstall the Azure DevOps Shell in, at least, the following targets:

  • Windows Terminal
  • Windows Start Menu
  • Windows Taskbar

Title:
Conditionally create Windows Terminal shortcut for Azure DevOps Shell in WiX installer

Description:
The current WiX-based installer for TfsCmdlets always creates an “Azure DevOps Shell” shortcut pointing to Windows PowerShell. We’d like to enhance both the MSI and new PowerShell-based installers so that, if Windows Terminal is installed on the user’s machine, they create a shortcut opening the “Azure DevOps Shell” profile in Windows Terminal; otherwise they fall back to the existing PowerShell shortcut.

Additionally, we need to introduce two new cmdlets—Install-TfsShell and Uninstall-TfsShell—to provide the same conditional behavior when users install TfsCmdlets via PowerShell Gallery. To fully support Windows Terminal, we’ll ship two JSON profile fragments (one for Windows PowerShell, one for PowerShell Core/7) named “Azure DevOps Shell,” and deploy them alongside the module.


Current Behavior:

  • In Setup/Product.wxs, the Azure DevOps Shell shortcut is hard-coded to launch PowerShell with Import-Module AzureDevOpsShell.
  • There are no Install-TfsShell or Uninstall-TfsShell cmdlets in the module.
  • No Windows Terminal profile fragments are provided.

Desired Behavior:

  1. Detection

    • Detect presence of Windows Terminal (e.g. via registry AppPath lookup for wt.exe or file search in %LocalAppData%\Microsoft\WindowsApps\wt.exe).
  2. MSI Installer

    • If found, create a desktop shortcut targeting:

      wt.exe -p "Azure DevOps Shell"
      
    • If not found, create the legacy PowerShell shortcut as today.

  3. PowerShell Gallery Installer

    • Implement Install-TfsShell to perform the same detection and shortcut creation logic at module install time.
    • Implement Uninstall-TfsShell to remove whichever shortcut was created.
  4. Windows Terminal Profile Fragments

    • Windows PowerShell profile (AzureDevOpsShell-WinPS.json), with command line:

      {
        "name": "Azure DevOps Shell (Windows PowerShell)",
        "commandline": "powershell.exe -NoExit -Command Import-Module AzureDevOpsShell",
        "icon": "ms-appx:///ProfileIcons/PowerShell.png",
        "startingDirectory": "%USERPROFILE%"
      }
    • PowerShell Core profile (AzureDevOpsShell-PSCore.json), with command line:

      {
        "name": "Azure DevOps Shell (PowerShell Core)",
        "commandline": "pwsh.exe -NoExit -Command Import-Module AzureDevOpsShell",
        "icon": "ms-appx:///ProfileIcons/PowerShellCore.png",
        "startingDirectory": "%USERPROFILE%"
      }
    • Install these fragments into the user’s WT settings folder (e.g. %LocalAppData%\Packages\Microsoft.WindowsTerminal_8wekyb3d8bbwe\LocalState\profiles\) on install, and remove them on uninstall.


Proposed Changes:

  • WiX (Product.wxs)

    • Add <AppSearch> or <DirectorySearch> + <FileSearch> to set a WTPATH property for wt.exe.

    • Define two mutually-exclusive <Component> entries under DesktopFolder:

      • Windows Terminal shortcut: conditioned on WTPATH, targeting [WTPATH] with -p "Azure DevOps Shell".
      • PowerShell shortcut: conditioned on NOT WTPATH, targeting PowerShell as today.
  • PowerShell Module

    • New cmdlets:

      • Install-TfsShell — detect WT, install the appropriate shortcut, and deploy both profile fragments.
      • Uninstall-TfsShell — remove the shortcut and both profile fragments.
  • Profile Fragments

    • Add AzureDevOpsShell-WinPS.json and AzureDevOpsShell-PSCore.json under module assets.
    • Copy/remove them in the WT settings folder on install/uninstall.

Acceptance Criteria:

  • MSI Installer: Creates WT-based shortcut when Windows Terminal is present; otherwise falls back to PowerShell.
  • PowerShell Gallery Installer: Install-TfsShell & Uninstall-TfsShell replicate the same logic.
  • Profile Fragments: Both “Azure DevOps Shell (Windows PowerShell)” and “Azure DevOps Shell (PowerShell Core)” profiles appear in Windows Terminal after installation and are removed on uninstall.
  • No regressions in existing PowerShell-only scenarios.

References:

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions