Skip to content

Contributing to PowerShell Tools for Visual Studio

Adam Driscoll edited this page Jan 4, 2025 · 4 revisions

This guide will instruct you on how to build the PowerShell Tools for Visual Studio extension

Requirements

Build Process

Start Visual Studio as Administrator. Administrator access is required because the PowerShell Pro Tools build copies files into the Visual Studio directory for debugging purposes.

Build the PowerShellTools project to build the Visual Studio 2019 extension and the PowerShellTools.2022 to build the Visual Studio 2022 and later extension.

Debugging

Debugging can be accomplished through Visual Studio. Set the startup project to PowerShellTools.2022 and press F5 to launch the experimental instance and debug the extension.

If you launch Visual Studio and the extension fails to load, you may need to remove the VS 2019 extension. If you built the entire solution of the PowerShellTools project in Visual Studio 2022, then the older version of the extension was also installed in the experimental instance. This results in the extension failing to load and duplicate project and item templates. Remove the 2019 extension by click Extensions \ Manage Extensions and then uninstall PowerShell Tools for Visual Studio. You will need to restart the experimental instance. You do not need to remove the PowerShell Tools for Visual Studio 2022.

Code Layout

./build

Contains MSBuild settings and targets files that are used in the PoshTools projects.

./Common

Common models, interfaces and helpers for PoshTools.

./HostInjection

Refactoring used in both the VS and VS Code extensions.

./PowerShellTools.Shared

Contains the bulk of the Visual Studio extension. Includes the Project system, IntelliSense, debugging system and more. Shared between the VS2019 and VS2022+ extensions.

./PowerShellTools

The base project for the VS2019 extension. Mainly references the Shared project.

./PowerShellTools.2022

The base project for the VS2022+ extension. Mainly references the Shared project.

./PowerShellTools.MSBuild

MSBuild targets for packaging.

./PowerShellTools.Templates.*

Project and file templates like modules, scripts and form projects.

./PowerShellTools.Packager

Packager library used to turn PowerShell scripts into executables.

./FormDesigner

Form designer parsing and generation logic.