...

Zero to Code in Minutes: How to Automate Your Development Environment Setup with WinGet

WinGet and DSC Development Environment Automation

Every developer knows the collective sigh that accompanies setting up a new machine. Whether onboarding a new team member, replacing a broken laptop, or spinning up a clean virtual sandbox, configuring a local environment is notoriously tedious. Downloading text editors, configuring runtime environments, setting system path variables, and pulling dependencies manually can easily swallow an entire workday.

Worse, minor version discrepancies between team members often trigger the dreaded “well, it works on my machine” syndrome.

Fortunately, the days of hunting down .exe files across the internet are over. Microsoft’s native Windows Package Manager, WinGet, coupled with Desired State Configuration (DSC), turns local environment provisioning into a fast, repeatable, and automated pipeline.

The Shift to Infrastructure as Code (IaC) for Your Local Machine

For years, macOS developers have relied on Homebrew, while Windows power users turned to third-party tools like Chocolatey or Scoop. However, WinGet changes the landscape because it comes baked directly into Windows 11 and Windows Server.

More importantly, it has evolved from a simple command-line tool into a robust system configuration engine. Rather than writing long, fragile sequential Bash or PowerShell scripts that blindly execute commands one after the other, you can now define your entire workspace using an Infrastructure as Code (IaC) approach.

With WinGet environment automation, you write a declarative configuration file. You tell the system the exact final state you want it to be in, and the WinGet engine handles the logic to make it happen.

The Building Blocks: Working with WinGet Configurations

To automate your workflow, you use a .dsc.yaml configuration file. This file contains a clear manifest of the software, tools, settings, and versions your system requires.

A standard configuration file relies on three distinct operational layers:

  • Get: Evaluates the current configuration status of the host machine.
  • Test: Audits the host machine against your configuration file to verify if the correct software or versions are missing (also known as drift detection).
  • Set: Actively installs the missing packages and applies specified settings to align the system with the desired state.

Generating Your First Configuration File

You don’t need to write complex YAML blocks from scratch. If you already have a “gold standard” developer machine configured exactly how you like it, you can command WinGet to reverse-engineer your system into a shareable template.

By executing the following command in an elevated PowerShell prompt:

PowerShell

winget export -o dev-env.dsc.yaml --include-versions

WinGet takes a snapshot of your inventory and exports it. From there, you can wrap it into a structured DSC schema that defines the exact packages required for your team. A simplified version of a valid configuration document looks like this:

YAML

# yaml-language-server: $schema=https://aka.ms/configuration-dsc-schema/0.2
properties:
  configurationVersion: 0.2.0
  resources:
    - resource: Microsoft.WinGet.DSC/WinGetPackage
      directives:
        description: Install Visual Studio Code
      settings:
        id: Microsoft.VisualStudioCode
        version: latest
    - resource: Microsoft.WinGet.DSC/WinGetPackage
      directives:
        description: Install Git
      settings:
        id: Git.Git

Executing the Workflow Automation

Once your configuration file is housed safely in a shared Git repository or local folder, spinning up a ready-to-code machine requires only a few rapid terminal steps.

Step 1: Validate Your Setup

Before running a blind installation, it is highly recommended to run a syntax check. You can use tools like the graphical WinGet Studio or run a simple CLI validation check to verify that your file adheres to Microsoft’s schemas:

PowerShell

winget configure validate -f .\dev-env.dsc.yaml

Step 2: Test for System Drift

If you are running the configuration on an existing machine that might already have some tools installed, you can scan for what is missing without making any modifications:

PowerShell

winget configure test -f .\dev-env.dsc.yaml

Step 3: Enforce the Setup

To trigger the unattended automation process, run the set equivalent command. By appending the interactive suppression flags, the manager will silently fetch the binaries, check SHA-256 integrity hashes, bypass license prompts, and install everything in the background:

PowerShell

winget configure -f .\dev-env.dsc.yaml --accept-configuration-agreements --disable-interactivity

Maximizing the Value of WinGet in Engineering Teams

Moving past simple software deployment, true automation handles deeper settings. Beyond downloading compilers like Python, Go, or Rust, WinGet configurations integrate with Windows Developer Settings.

This means your automation scripts can natively enable the Windows Subsystem for Linux (WSL), format Dev Drives for hyper-fast disk I/O performance during compilation, and even tweak File Explorer parameters—such as permanently showing hidden files and file extensions.

Automation GoalOld MethodModern WinGet Method
App InstallsNavigating websites, running manual WizardsDeclarative WinGetPackage resources
Version ControlManual version match checkingversion: "x.x.x" pinning in DSC YAML
System SettingsRegistry edits, manual Control Panel clicksIntegrated Windows Developer Configurations
Team OnboardingMulti-page text wikis and readme filesA single git pull & winget configure
Seraphinite AcceleratorOptimized by Seraphinite Accelerator
Turns on site high speed to be attractive for people and search engines.