Table of Contents

VS Code Installation and Setup

This guide provides comprehensive instructions for installing and configuring Visual Studio Code with a focus on PowerShell development across Windows and Linux platforms.

Prerequisites

Before beginning the installation process, ensure you have:

  • Administrative privileges on your system
  • Active internet connection for downloading packages
  • Basic familiarity with command-line interfaces

Install VS Code

Install without customization:

winget install --id Microsoft.VisualStudioCode -e --source winget

Install with custom options (silent install, add context menu entries):

winget install Microsoft.VisualStudioCode --override '/SILENT /mergetasks="!runcode,addcontextmenufiles,addcontextmenufolders"'

Method 2: Manual Download

  1. Visit VS Code Download Page
  2. Download the Windows installer (.exe)
  3. Run the installer and follow the setup wizard

Method 3: Chocolatey

choco install vscode

Install Git

Git is essential for version control and is required for many VS Code features and extensions.

Method 1: WinGet

winget install --id Git.Git -e --source winget

Method 2: Chocolatey

choco install git

Method 3: Manual Download

Download from Git for Windows and run the installer.

Install PowerShell

PowerShell 7+ provides cross-platform scripting capabilities and enhanced features for modern development.

WinGet Installation

winget install --id Microsoft.PowerShell -e --source winget

Alternative: Microsoft Store

Search for "PowerShell" in the Microsoft Store and install.

Verify Installation

pwsh --version

Essential VS Code Extensions for PowerShell

After installing VS Code, install these essential extensions for PowerShell development:

Core Extensions

# PowerShell extension (essential)
code --install-extension ms-vscode.PowerShell

# Additional recommended extensions
code --install-extension ms-vscode.vscode-json
code --install-extension redhat.vscode-yaml
code --install-extension streetsidesoftware.code-spell-checker
code --install-extension davidanson.vscode-markdownlint

Extension Details

Extension Publisher Purpose
PowerShell Microsoft Syntax highlighting, IntelliSense, debugging
JSON Microsoft JSON file support and validation
YAML Red Hat YAML syntax support
Code Spell Checker Street Side Software Spell checking in code and comments
markdownlint David Anson Markdown linting and formatting

Initial Configuration

PowerShell Extension Settings

Open VS Code settings (Ctrl+, / Cmd+,) and configure:

{
    "powershell.codeFormatting.preset": "OTBS",
    "powershell.codeFormatting.openBraceOnSameLine": false,
    "powershell.codeFormatting.newLineAfterOpenBrace": true,
    "powershell.codeFormatting.newLineAfterCloseBrace": true,
    "powershell.scriptAnalysis.enable": true,
    "powershell.integratedConsole.showOnStartup": false
}

Verify Setup

  1. Open VS Code: Launch Visual Studio Code
  2. Open PowerShell Terminal: TerminalNew Terminal → Select PowerShell
  3. Test PowerShell: Run $PSVersionTable to verify PowerShell is working
  4. Create Test Script: Create a new .ps1 file and verify syntax highlighting works

Troubleshooting

Common Issues

PowerShell Extension Not Loading

# Update PowerShell to latest version
winget upgrade Microsoft.PowerShell

# Reload VS Code window
# Ctrl+Shift+P → "Developer: Reload Window"

Git Not Recognized

# Restart VS Code after Git installation
# Check PATH includes Git installation directory

Linux Permission Issues

# Fix VS Code desktop entry permissions
sudo chmod +x /usr/share/applications/code.desktop

# Fix executable permissions
sudo chmod +x /usr/bin/code

Next Steps

After completing the installation:

  1. Configure PowerShell Development: See the VS Code Configuration Guide for optimal PowerShell settings
  2. Learn Productivity Tips: Explore VS Code Tips and Tricks for keyboard shortcuts and advanced features
  3. Set Up Code Snippets: Create custom templates with the VS Code Snippets Guide
  4. Set Up Version Control: Configure Git repositories for your PowerShell projects
  5. Install Additional Extensions: Explore the VS Code marketplace for productivity extensions

References and Additional Resources

Official Documentation

Installation Guides

PowerShell Extension Resources

Package Managers

Community Resources

Advanced Configuration


Last updated: {{ site.time | date: "%Y-%m-%d" }}