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
Method 1: WinGet (Recommended)
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
- Visit VS Code Download Page
- Download the Windows installer (.exe)
- 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
- Open VS Code: Launch Visual Studio Code
- Open PowerShell Terminal:
Terminal
→New Terminal
→ Select PowerShell - Test PowerShell: Run
$PSVersionTable
to verify PowerShell is working - 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:
- Configure PowerShell Development: See the VS Code Configuration Guide for optimal PowerShell settings
- Learn Productivity Tips: Explore VS Code Tips and Tricks for keyboard shortcuts and advanced features
- Set Up Code Snippets: Create custom templates with the VS Code Snippets Guide
- Set Up Version Control: Configure Git repositories for your PowerShell projects
- Install Additional Extensions: Explore the VS Code marketplace for productivity extensions
References and Additional Resources
Official Documentation
- Visual Studio Code Documentation - Comprehensive VS Code documentation
- PowerShell Documentation - Official PowerShell documentation by Microsoft
- Git Documentation - Official Git documentation and tutorials
Installation Guides
- VS Code on Linux - Official Linux installation guide
- Installing PowerShell on Ubuntu - Microsoft's Ubuntu installation guide
- Git for Windows - Git installation for Windows systems
PowerShell Extension Resources
- PowerShell Extension for VS Code - Official extension page
- PowerShell Extension Documentation - Usage guide and features
- PowerShell Development in VS Code - Microsoft's development guide
Package Managers
- WinGet Documentation - Windows Package Manager guide
- Chocolatey - Package manager for Windows
- Snap Store - Universal Linux packages
Community Resources
- VS Code Tips and Tricks - Productivity tips
- PowerShell Community - PowerShell GitHub repository
- r/PowerShell - PowerShell community on Reddit
Advanced Configuration
- VS Code User and Workspace Settings - Configuration guide
- PowerShell Profiles - Customizing PowerShell environment
- Git Configuration - Git setup and customization
Last updated: {{ site.time | date: "%Y-%m-%d" }}