Automating Development Tools Installation with WinGet and DSC
Streamline the installation of essential development tools using winget (Windows Package Manager) and Desired State Configuration (DSC). With this approach, you can automate the setup of applications and tools, ensuring consistency across your environment.
General Overview
- This configuration leverages winget to install applications and tools automatically.
- It adopts the version format
configurationVersion: 0.2.0
. - Resources are defined using the Microsoft.WinGet.DSC schema for
WinGetPackage
, simplifying the setup process.
Key Resources and Their Purpose
1. Git
- Installs Git for version control, supporting collaborative coding and repository management.
- Pre-release versions are enabled (
allowPrerelease: true
). - Package ID:
Git.Git
.
2. GitHub CLI
- Facilitates command-line interaction with GitHub repositories, streamlining workflows.
- Pre-release versions are enabled.
- Package ID:
GitHub.cli
.
3. WinMerge
- Provides powerful tools for comparing and merging files, a must-have for developers.
- Pre-releases are supported.
- Package ID:
WinMerge.WinMerge
.
4. Microsoft .NET SDK 8.0
- Installs the latest version of .NET SDK (8.0) for application development.
- Pre-releases are enabled for early access.
- Package ID:
Microsoft.DotNet.SDK.8
.
5. Visual Studio 2022 Community Edition
- Sets up Visual Studio 2022 Community Edition for comprehensive development.
- Includes support for pre-release features.
- Package ID:
Microsoft.VisualStudio.2022.Community
.
6. VS Components
- Installs additional Visual Studio workloads as specified in the
.vsconfig
file located in the${WinGetConfigRoot}
directory. - Depends on the installation of Visual Studio.
- DependsOn: VisualStudio.
7. Visual Studio Code
- Deploys VS Code, a lightweight and versatile code editor.
- Supports pre-release versions for cutting-edge features.
- Package ID:
Microsoft.VisualStudioCode
.
How It Works
- Directives: Specify metadata like descriptions and enable pre-release versions.
- Settings: Define the package ID and source (
winget
) for each tool. - Dependencies: Manage installation order; e.g., VS Components require Visual Studio to be installed first.
Configuration Example
Here is an example configuration using the Microsoft.WinGet.DSC schema:
properties:
configurationVersion: 0.2.0
resources:
- resource: Microsoft.WinGet.DSC/WinGetPackage
id: Git
directives:
description: Install Git
allowPrerelease: true
settings:
id: Git.Git
source: winget
- resource: Microsoft.WinGet.DSC/WinGetPackage
id: GitHubClI
directives:
description: Install GitHub Cli
allowPrerelease: true
settings:
id: GitHub.cli
source: winget
- resource: Microsoft.WinGet.DSC/WinGetPackage
id: WinMerge
directives:
description: Install WinMerge
allowPrerelease: true
settings:
id: WinMerge.WinMerge
source: winget
- resource: Microsoft.WinGet.DSC/WinGetPackage
id: DotNetSDK8
directives:
description: Install Microsoft .NET SDK 8.0
allowPrerelease: true
settings:
id: Microsoft.DotNet.SDK.8
source: winget
- resource: Microsoft.WinGet.DSC/WinGetPackage
id: VisualStudio
directives:
description: Install Visual Studio 2022 Community
allowPrerelease: true
settings:
id: Microsoft.VisualStudio.2022.Community
source: winget
- resource: Microsoft.VisualStudio.DSC/VSComponents
directives:
description: Install required VS workloads from project .vsconfig file
allowPrerelease: true
settings:
productId: Microsoft.VisualStudio.Product.Community
channelId: VisualStudio.17.Release
vsConfigFile: '${WinGetConfigRoot}\.vsconfig'
dependsOn:
- VisualStudio
- resource: Microsoft.WinGet.DSC/WinGetPackage
id: VisualStudioCode
directives:
description: Install Visual Studio Code
allowPrerelease: true
settings:
id: Microsoft.VisualStudioCode
source: winget
Conclusion
By automating your development environment setup with winget and DSC, you can save time and ensure consistency across installations. Whether you’re setting up a new machine or standardizing tools for a team, this approach simplifies the process and reduces manual effort. Let me know how you’d like to customize this configuration for your projects!