Back in March I posted about Automated and repeatable Environment Setup. In that version of the environment setup, I used Chocolatey because it has always been my go-to Windows app installer. However, the latest versions of Windows 10 and 11 comes with winget pre-installed. In this post, I will show how to setup a similar developer environment but using winget instead of chocolatey.
Similarly to the last post, I will focus on a typical .NET + Node developer environment.
Note that we add --accept-source-agreements and --accept-package-agreements options. The former is only needed once to accept the agreeement to use winget repository. The later is used in each package install to accept any agreement required by the package.
Run these commands as admin in either preinstalled Command Prompt or PowerShell:
To ensure the environment variables are all set for oh-my-posh, restart terminal as admin and run the following commands
1
2
3
4
5
6
7
8
Add-Content -Path $PROFILE -Value 'oh-my-posh --init --shell pwsh --config https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/v$(oh-my-posh --version)/themes/marcduiker.omp.json | Invoke-Expression'oh-my-posh font install Meslo
# USE AT YOUR OWN RISK, if the file structure changes, this could break your environment# This will modify the profile settings file to use the downloaded nerd font$json = Get-Content "$env:LocalAppData\Packages\Microsoft.WindowsTerminal_8wekyb3d8bbwe\LocalState\settings.json" | ConvertFrom-Json
$json.profiles.defaults = @{font = @{face = "MesloLGM NF"}}
$json | ConvertTo-Json -depth 10 | Out-File "$env:LocalAppData\Packages\Microsoft.WindowsTerminal_8wekyb3d8bbwe\LocalState\settings.json"
Using winget is very similar to chocolatey. The primary difference at this moment is in package offering in favor of Chocolatey and the need to install another tool in favor of winget. At this point, both can do the job and they can do it quite well.