-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Add dev environment setup with WinGet Configuration #40117
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
benhillis
wants to merge
2
commits into
master
Choose a base branch
from
user/benhill/setup-dev-env
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| # yaml-language-server: $schema=https://aka.ms/configuration-dsc-schema/0.2 | ||
| # Reference: https://github.com/microsoft/WSL/blob/master/doc/docs/dev-loop.md | ||
| # | ||
| # Usage: winget configure -f .config/configuration.vsEnterprise.winget | ||
| # | ||
| # Visual Studio 2022 Enterprise edition. For other editions use: | ||
| # .config/configuration.winget (Community, default) | ||
| # .config/configuration.vsProfessional.winget (Professional) | ||
| properties: | ||
| resources: | ||
| - resource: Microsoft.Windows.Settings/WindowsSettings | ||
| directives: | ||
| description: Enable Developer Mode (required for symbolic link support) | ||
| allowPrerelease: true | ||
| securityContext: elevated | ||
| settings: | ||
| DeveloperMode: true | ||
| - resource: Microsoft.WinGet.DSC/WinGetPackage | ||
| id: cmake | ||
| directives: | ||
| description: Install CMake | ||
| securityContext: elevated | ||
| settings: | ||
| id: Kitware.CMake | ||
| source: winget | ||
| - resource: Microsoft.WinGet.DSC/WinGetPackage | ||
| id: vsPackage | ||
| directives: | ||
| description: Install Visual Studio 2022 Enterprise | ||
| securityContext: elevated | ||
| settings: | ||
| id: Microsoft.VisualStudio.2022.Enterprise | ||
| source: winget | ||
| - resource: Microsoft.VisualStudio.DSC/VSComponents | ||
| dependsOn: | ||
| - vsPackage | ||
| directives: | ||
| description: Install required VS workloads from .vsconfig | ||
| allowPrerelease: true | ||
| securityContext: elevated | ||
| settings: | ||
| productId: Microsoft.VisualStudio.Product.Enterprise | ||
| channelId: VisualStudio.17.Release | ||
| vsConfigFile: '${WinGetConfigRoot}\..\.vsconfig' | ||
| configurationVersion: 0.2.0 | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| # yaml-language-server: $schema=https://aka.ms/configuration-dsc-schema/0.2 | ||
| # Reference: https://github.com/microsoft/WSL/blob/master/doc/docs/dev-loop.md | ||
| # | ||
| # Usage: winget configure -f .config/configuration.vsProfessional.winget | ||
| # | ||
| # Visual Studio 2022 Professional edition. For other editions use: | ||
| # .config/configuration.winget (Community, default) | ||
| # .config/configuration.vsEnterprise.winget (Enterprise) | ||
| properties: | ||
| resources: | ||
| - resource: Microsoft.Windows.Settings/WindowsSettings | ||
| directives: | ||
| description: Enable Developer Mode (required for symbolic link support) | ||
| allowPrerelease: true | ||
| securityContext: elevated | ||
| settings: | ||
| DeveloperMode: true | ||
| - resource: Microsoft.WinGet.DSC/WinGetPackage | ||
| id: cmake | ||
| directives: | ||
| description: Install CMake | ||
| securityContext: elevated | ||
| settings: | ||
| id: Kitware.CMake | ||
| source: winget | ||
| - resource: Microsoft.WinGet.DSC/WinGetPackage | ||
| id: vsPackage | ||
| directives: | ||
| description: Install Visual Studio 2022 Professional | ||
| securityContext: elevated | ||
| settings: | ||
| id: Microsoft.VisualStudio.2022.Professional | ||
| source: winget | ||
| - resource: Microsoft.VisualStudio.DSC/VSComponents | ||
| dependsOn: | ||
| - vsPackage | ||
| directives: | ||
| description: Install required VS workloads from .vsconfig | ||
| allowPrerelease: true | ||
| securityContext: elevated | ||
| settings: | ||
| productId: Microsoft.VisualStudio.Product.Professional | ||
| channelId: VisualStudio.17.Release | ||
| vsConfigFile: '${WinGetConfigRoot}\..\.vsconfig' | ||
| configurationVersion: 0.2.0 | ||
|
benhillis marked this conversation as resolved.
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| # yaml-language-server: $schema=https://aka.ms/configuration-dsc-schema/0.2 | ||
| # Reference: https://github.com/microsoft/WSL/blob/master/doc/docs/dev-loop.md | ||
| # | ||
| # Usage: winget configure -f .config/configuration.winget | ||
| # | ||
| # This is the default configuration (VS Community). For other editions use: | ||
| # .config/configuration.vsProfessional.winget | ||
| # .config/configuration.vsEnterprise.winget | ||
| properties: | ||
| resources: | ||
| - resource: Microsoft.Windows.Settings/WindowsSettings | ||
| directives: | ||
| description: Enable Developer Mode (required for symbolic link support) | ||
| allowPrerelease: true | ||
| securityContext: elevated | ||
| settings: | ||
| DeveloperMode: true | ||
| - resource: Microsoft.WinGet.DSC/WinGetPackage | ||
| id: cmake | ||
| directives: | ||
| description: Install CMake | ||
| securityContext: elevated | ||
| settings: | ||
| id: Kitware.CMake | ||
| source: winget | ||
| - resource: Microsoft.WinGet.DSC/WinGetPackage | ||
| id: vsPackage | ||
| directives: | ||
| description: Install Visual Studio 2022 Community | ||
| securityContext: elevated | ||
| settings: | ||
| id: Microsoft.VisualStudio.2022.Community | ||
| source: winget | ||
| - resource: Microsoft.VisualStudio.DSC/VSComponents | ||
| dependsOn: | ||
| - vsPackage | ||
| directives: | ||
| description: Install required VS workloads from .vsconfig | ||
| allowPrerelease: true | ||
| securityContext: elevated | ||
| settings: | ||
| productId: Microsoft.VisualStudio.Product.Community | ||
| channelId: VisualStudio.17.Release | ||
| vsConfigFile: '${WinGetConfigRoot}\..\.vsconfig' | ||
| configurationVersion: 0.2.0 | ||
|
benhillis marked this conversation as resolved.
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| { | ||
| "version": "1.0", | ||
| "components": [ | ||
| "Microsoft.Component.MSBuild", | ||
| "Microsoft.VisualStudio.Component.VC.CoreIde", | ||
| "Microsoft.VisualStudio.Component.VC.Tools.x86.x64", | ||
| "Microsoft.VisualStudio.Component.VC.Tools.ARM64", | ||
| "Microsoft.VisualStudio.Component.VC.Tools.x86.x64.Spectre", | ||
| "Microsoft.VisualStudio.Component.VC.Tools.ARM64.Spectre", | ||
| "Microsoft.VisualStudio.Component.VC.ATL", | ||
| "Microsoft.VisualStudio.Component.VC.ATL.ARM64", | ||
| "Microsoft.VisualStudio.Component.VC.ATL.Spectre", | ||
| "Microsoft.VisualStudio.Component.VC.ATL.ARM64.Spectre", | ||
| "Microsoft.VisualStudio.Component.VC.Llvm.Clang", | ||
| "Microsoft.VisualStudio.Component.Windows11SDK.26100", | ||
| "Microsoft.VisualStudio.Component.UWP.VC.ARM64", | ||
| "Microsoft.VisualStudio.Workload.ManagedDesktop", | ||
| "Microsoft.VisualStudio.Workload.Universal", | ||
| "Microsoft.VisualStudio.Workload.NativeDesktop" | ||
| ] | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,85 @@ | ||
| <# | ||
| .SYNOPSIS | ||
| Sets up the development environment for building WSL. | ||
| .DESCRIPTION | ||
| Detects any existing Visual Studio 2022 installation and runs the | ||
| matching WinGet Configuration to install all prerequisites: | ||
| Developer Mode, CMake, Visual Studio 2022, and required workloads | ||
| from .vsconfig. | ||
|
|
||
| If VS 2022 is already installed, the script picks the configuration | ||
| matching that edition (Community, Professional, or Enterprise). | ||
| If no VS 2022 is found, it defaults to Community edition. | ||
| .EXAMPLE | ||
| .\tools\setup-dev-env.ps1 | ||
| #> | ||
|
|
||
| Set-StrictMode -Version Latest | ||
| $ErrorActionPreference = "Stop" | ||
|
|
||
| $repoRoot = (Resolve-Path "$PSScriptRoot\..").Path | ||
| $configDir = Join-Path $repoRoot ".config" | ||
|
|
||
| # ── Detect existing VS 2022 edition ───────────────────────────────── | ||
| $configFile = "configuration.winget" # default: Community | ||
| $vswhere = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" | ||
|
|
||
| if (Test-Path $vswhere) | ||
| { | ||
| $productId = (& $vswhere -version "[17.0,18.0)" -products * -latest -property productId 2>$null | | ||
| Select-Object -First 1) | ||
|
|
||
| if ($productId) { $productId = $productId.Trim() } | ||
|
|
||
| switch ($productId) | ||
| { | ||
| "Microsoft.VisualStudio.Product.Professional" { | ||
| $configFile = "configuration.vsProfessional.winget" | ||
| Write-Host "Detected VS 2022 Professional - using $configFile" -ForegroundColor Green | ||
| } | ||
| "Microsoft.VisualStudio.Product.Enterprise" { | ||
| $configFile = "configuration.vsEnterprise.winget" | ||
| Write-Host "Detected VS 2022 Enterprise - using $configFile" -ForegroundColor Green | ||
| } | ||
| "Microsoft.VisualStudio.Product.Community" { | ||
| Write-Host "Detected VS 2022 Community - using $configFile" -ForegroundColor Green | ||
| } | ||
| default { | ||
| Write-Host "No VS 2022 found - will install Community edition" -ForegroundColor Yellow | ||
| } | ||
| } | ||
| } | ||
| else | ||
| { | ||
| Write-Host "No VS 2022 found - will install Community edition" -ForegroundColor Yellow | ||
| } | ||
|
|
||
| $configPath = Join-Path $configDir $configFile | ||
|
|
||
| # ── Run WinGet Configuration ──────────────────────────────────────── | ||
| Write-Host "" | ||
| Write-Host "Running WinGet Configuration ($configFile)..." -ForegroundColor Cyan | ||
| Write-Host " This will install: Developer Mode, CMake, VS 2022 + required components" | ||
| Write-Host "" | ||
|
|
||
| winget configure --enable | ||
| if ($LASTEXITCODE -ne 0) | ||
|
benhillis marked this conversation as resolved.
|
||
| { | ||
| Write-Host "Failed to enable WinGet configuration feature." -ForegroundColor Red | ||
| exit 1 | ||
| } | ||
|
|
||
| winget configure -f "$configPath" --accept-configuration-agreements | ||
| if ($LASTEXITCODE -ne 0) | ||
| { | ||
| Write-Host "Failed to apply WinGet configuration file: $configFile" -ForegroundColor Red | ||
| exit 1 | ||
| } | ||
|
|
||
| # ── Done ──────────────────────────────────────────────────────────── | ||
| Write-Host "" | ||
| Write-Host "All prerequisites installed. Ready to build!" -ForegroundColor Green | ||
| Write-Host "" | ||
| Write-Host " cmake ." | ||
| Write-Host " cmake --build . -- -m" | ||
| Write-Host "" | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.