Scripting Guys Blog Posts on Using Visual Studio Code for PowerShell Development
Keith Hill's Blog
by rkeithhill
3y ago
If  you’re looking for a bit more up-to-date getting started guide on using PowerShell with Visual Studio Code, check out these blog posts: Get started with PowerShell development in Visual Studio Code Visual Studio Code editing features for PowerShell development – Part 1 Visual Studio Code editing features for PowerShell development – Part 2 Debugging PowerShell script in Visual Studio Code – Part 1 Debugging PowerShell script in Visual Studio Code – Part 2 ..read more
Visit website
Preview of Module Build and Publish with Visual Studio Code and the PowerShell Extension
Keith Hill's Blog
by rkeithhill
3y ago
We are noodling around with how to best provide support for publishing modules to the PowerShell Gallery from a PowerShell workspace within Visual Studio Code.  In today’s release of the PowerShell extension for VSCode (version 0.5.0), we have included an example of how this might work in a future release which I’ll discuss at length in this blog post. If you haven’t already got Visual Studio Code and the PowerShell extension, see my blog post on Getting Started with Visual Studio Code.  If you already have Visual Studio Code and the PowerShell extension, make sure you have updated b ..read more
Visit website
Breakpoint Enhancements in the v0.5.0 PowerShell Extension for Visual Studio Code
Keith Hill's Blog
by rkeithhill
3y ago
Visual Studio Code 0.10.10 released today with many new features including indentation-based code folding and UI support for configuring “function” breakpoints.  In this blog post, I’ll show you a few new features what we have planned for the 0.5.0 release of the PowerShell extension for Visual Studio Code, which should be available towards the end of March.  The two features I’ll show in this blog post are support for conditional breakpoints and function breakpoints in the VSCode debugger. Conditional Line Breakpoints Conditional line breakpoints will break on a line of script only ..read more
Visit website
Creating a PowerShell Command that Process Paths using Visual Studio Code
Keith Hill's Blog
by rkeithhill
3y ago
Writing functions that need to process paths in PowerShell and do everything that PowerShell users expect can be tricky.  Here are some of the features that folks expect for a fictitious function called “Edit-File” (well, there *is* an Edit-File command in PSCX) : PS C:\> Edit-File –Path C:\foo.txt, C:\bar.txt # do you handle an array of paths PS C:\> Edit-File –Path C:\*.txt # do you support wildcards PS C:\> Edit-File –Path ..\foo.txt # do you support relative paths PS C:\> Edit-File –Path ~\foo.txt # do you resolve paths with ~ in them PS C:\> Edit-File –LiteralPath C ..read more
Visit website
New Release of PowerShell Extension For Visual Studio Code
Keith Hill's Blog
by rkeithhill
3y ago
There’s a new version (0.4.0) of the PowerShell extension for Visual Studio Code out with some really nice enhancements.  There’s also a new version of Visual Studio Code (0.10.8) out with lots of improvements as well (read about those here).  I encourage you to pick up both!  If you don’t already have VSCode or the PowerShell Extension, see my blog post on Getting Started with Visual Studio Code for Use with PowerShell.  If you already have these, be sure to check for updates on both. The enhancements to the PowerShell extension fall into two different categories: editing ..read more
Visit website
Debugging PowerShell Script with Visual Studio Code
Keith Hill's Blog
by rkeithhill
3y ago
In this post we will look at how you can debug your PowerShell scripts using VSCode and the PowerShell Editor Services extension for VSCode.  As a pre-requisite see the post Getting Started with Visual Studio Code for Use with PowerShell on how to install VSCode and the PowerShell extension for VSCode. One disclaimer about debugging PowerShell script in VSCode before we start.  Even though VSCode is cross-platform, running on Windows, Linux and Mac OS, the debugging support provided by the PowerShell Editor Services extension currently runs only on Windows.  PowerShell MVP Adam ..read more
Visit website
Getting Started with Visual Studio Code for Use with PowerShell
Keith Hill's Blog
by rkeithhill
3y ago
Now that I’ve hopefully piqued your interest in using Visual Studio Code for editing and debugging PowerShell scripts, here is how you get started.  First, go to the Visual Studio code web site to download and install VSCode.  From here you can click on the Download for Windows button to install VSCode on your Windows machine: Note: if you are on Linux or Mac OS, scroll to the bottom of this page to download the respective versions. Once you have installed VSCode, install the PowerShell Editor Services extension by pressing Ctrl+P, then type “ext install PowerShell” and install the ..read more
Visit website
Debugging in the PowerShellEditorServices for Visual Studio Code
Keith Hill's Blog
by rkeithhill
3y ago
You’ve probably heard about Microsoft’s Visual Studio Code editor.  It was announced at the 2014 online Connect event.  It is a free, light-weight, cross-platform code editor supporting Windows, Linux and MacOS.  I’ve been a big fan and user of the built-in PowerShell ISE for years.  It is still the best “debugger” out there.  However the ISE editor limitations, lack of customization, lack of source control integration and general atrophy (ISE hasn’t been significantly updated since it shipped with V2) was really starting to get to me. As a user of Visual Studio, I rea ..read more
Visit website
PowerShell Snippets for Visual Studio Code
Keith Hill's Blog
by rkeithhill
3y ago
If you are a fan of using Visual Studio Code as a lightweight text editor and are also a PowerShell scripter, you have probably found VS Code’s PowerShell support somewhat lacking.  For instance, while it can syntax colorize PowerShell script such as showing $foo in the color for variables, it doesn’t know that ${global:foo} is also a variable.  I have submitted an issue on this along with an improved powershellDef.js file.  You should be able to pull that down from here.  Then copy that into your C:\Program Files (x86)\Microsoft VS Code\resources\app\plugins\vs.language.po ..read more
Visit website
An Explanation of the .NET add_EventName / remove_EventName Methods for PowerShell Scripters
Keith Hill's Blog
by rkeithhill
3y ago
If you have ever attempted to write a little WinForms or WPF UI using PowerShell you have no doubt run across a method like add_Click() e.g. Add-Type -AssemblyName System.Windows.Forms $form = New-Object Windows.Forms.Form $button = New-Object Windows.Forms.Button $button.Text = "Close" $button.add_Click({$form.Close()}) $form.Controls.Add($button) $form.ShowDialog() This might be a bit confusing if you are looking at C# examples or even the MSDN topic on a Windows Form Button.  It says the event name is simply “Click”.  What is going on here? When C# and .NET were first int ..read more
Visit website

Follow Keith Hill's Blog on FeedSpot

Continue with Google
Continue with Apple
OR