Be a PowerShell DevOps Lovin’ Superhero!

PowerShell Pro Tip for Developers: Add Visual Studio Dev Mode Module to Profile as an Alias.

--

The addition of the PowerShell Dev Mode to Visual Studio 2019 was a great thing for developers that do their own DevOps. Now we have a proper environment in PowerShell for automating MSBUILD and here’s a technique to make it available to be launched in your current session.

PowerShell has profile scripts, just like other command shell environments. Each edition of PowerShell places its profile script in different places and hosts such as CS Code can define their own profile script when string up the session. To simplify access to the script, there is a build in variable named Profile that has the full path to the script for the current environment. To see your profile path just type $Profile on a blank line.

PS C:\Users\xxx> $Profile
C:\Users\xxx\OneDrive\PowerShell\Microsoft.PowerShell_profile.ps1
PS C:\Users\xxx>

You can easily editor your profile with your favorite editor. I use VS Code because of it’s superb support for debugging PowerShell scripts.

PS C:\Users\xxx> code $Profile

This launches VS Code with your profile script. Most likely it’s an empty document. Let’s change that.

First, we need to give PowerShell a hint about where to find the module. We…

--

--

The Sharp Ninja

27+ years of professional software engineering has taught me a thing or three…