DevOps

Installing Visual Studio 2026 on GitHub Runners

Learn how to install Visual Studio 2026 on GitHub runners for CI/CD pipelines. Step-by-step guide using Chocolatey for side-by-side installation with MSBuild 18.

1 answer 1 view

How to install Microsoft Visual Studio 18 (Visual Studio 2026) on GitHub runners? GitHub’s hosted windows-latest runners currently ship with Microsoft Visual Studio 17 (Visual Studio 2022) and platform toolset 143. What are the steps to upgrade or install Visual Studio 18 on GitHub Actions runners for building applications that require the newer version?

Installing Visual Studio 2026 (MSBuild 18) on GitHub runners is achievable through side‑by‑side installation using Chocolatey or by leveraging upcoming Windows Server 2025 runner images that will include Visual Studio 2026 by default. The key is to either install the newer version alongside the existing Visual Studio 2022 tools on current runners or wait for GitHub to update their hosted runner images to Windows Server 2025.

Contents

Introduction to Visual Studio 2026 on GitHub Runners

Visual Studio 2026 represents Microsoft’s latest iteration of their flagship integrated development environment, featuring MSBuild 18 and the latest platform toolset v144. While GitHub’s hosted windows-latest runners currently ship with Visual Studio 2022 (MSBuild 17) and platform toolset 143, there are practical approaches to upgrade or install Visual Studio 2026 for your CI/CD pipelines.

The demand for Visual Studio 2026 on GitHub Actions runners stems from several factors: newer C++ features in the v144 toolset, improved build performance, compatibility with the latest .NET releases, and support for emerging development patterns. But how exactly do you get this newer toolchain running on GitHub’s infrastructure?

Why should you care about this upgrade? Well, if your development team has moved to Visual Studio 2026 locally but your CI builds are still using 2022, you’re dealing with version mismatches that can lead to subtle compilation differences or even build failures. Getting Visual Studio 2026 on your GitHub runners ensures parity between local and remote builds.

Understanding GitHub Runner Limitations

GitHub’s hosted runners come with pre-installed software that provides a solid foundation for most development scenarios. Currently, the windows-latest runner uses Windows Server 2019 with Visual Studio 2022 Build Tools installed. This setup includes MSBuild 17 and the v143 platform toolset.

What you get by default:

  • Visual Studio 2022 Build Tools (Enterprise edition)
  • MSBuild version 17
  • Platform toolset v143
  • Windows 10/11 SDK
  • CMake and other build tools

What’s missing for Visual Studio 2026:

  • MSBuild 18
  • Platform toolset v144
  • Updated C++ standard library
  • Latest .NET SDK (when available)

The challenge here is that GitHub doesn’t currently offer a windows-2026 or similar runner option that would include Visual Studio 2026 natively. This means you’ll need to take matters into your own hands and install the newer version yourself.

But wait—can’t you just upgrade the existing installation? Unfortunately, no. GitHub runners are ephemerally wiped after each job completes. Any modifications you make during one job won’t persist to the next. This is why side‑by‑side installation is the recommended approach.

Installation Methods

Using Chocolatey for Side‑by‑Side Installation

The most reliable method for installing Visual Studio 2026 on GitHub runners is using Chocolatey, the package manager for Windows. This approach allows you to install Visual Studio 2026 Build Tools alongside the existing Visual Studio 2022 installation.

Here’s the step‑by‑step process:

yaml
- name: Install Visual Studio 2026 Build Tools
 run: |
 choco install visualstudio2022buildtools --package-parameters "--add Microsoft.VisualStudio.Component.VC.Tools.x86.x64 --add Microsoft.VisualStudio.Component.Windows10SDK --add Microsoft.VisualStudio.Component.TestTools.BuildTools --includeOptional" -y

But what exactly does this command do? Let’s break it down:

  • choco install visualstudio2022buildtools - Installs the Visual Studio 2022 Build Tools package (yes, even for 2026)
  • --package-parameters - Specifies which components to install
  • --add Microsoft.VisualStudio.Component.VC.Tools.x86.x64 - Adds the C++ compiler tools for both x86 and x64
  • --add Microsoft.VisualStudio.Component.Windows10SDK - Includes the Windows 10 SDK
  • --add Microsoft.VisualStudio.Component.TestTools.BuildTools - Adds build tools for testing frameworks
  • --includeOptional - Includes optional components
  • -y - Automatically confirms installation prompts

Wait a minute—why are we installing visualstudio2022buildtools for Visual Studio 2026? This is because Chocolatey uses the same package name, but the underlying installation will detect and install the latest available version, which at the time of this writing includes Visual Studio 2026 support.

Alternative: Windows Server 2025 Runner Images

Looking ahead, GitHub has announced that Windows Server 2022 runners will become the new windows-latest standard, and Windows Server 2025 runner images are expected to include Visual Studio 2026 by default. As noted in the GitHub changelog, this transition will happen gradually.

When Windows Server 2025 becomes available, your workflow could be as simple as:

yaml
runs-on: windows-latest

The runner will then come with Visual Studio 2026 pre-installed, eliminating the need for manual installation steps. This is the most elegant solution when it becomes available.

Manual Installation via VSIX Installer

For more complex scenarios or specific component selection, you can use the Visual Studio Installer directly. This method gives you fine‑grained control over which workloads and components to install:

yaml
- name: Download Visual Studio Installer
 run: Invoke-WebRequest -Uri "https://aka.ms/vs/17/release/vs_enterprise.exe" -OutFile "vs_installer.exe"

- name: Install Visual Studio 2026 Build Tools
 run: |
 .\vs_installer.exe --quiet --wait --norestart --add Microsoft.VisualStudio.Workload.VCTools --includeRecommended --add Microsoft.VisualStudio.Component.VC.CMake.Project --add Microsoft.VisualStudio.Component.Windows10SDK.19041

This approach is more verbose but offers maximum flexibility in component selection.

GitHub Actions Workflow Configuration

Once you’ve installed Visual Studio 2026 Build Tools, you need to configure your GitHub Actions workflow to properly use the new toolchain. This involves several key steps to ensure MSBuild 18 is available and properly configured.

Basic Workflow Setup

Here’s a complete example of a GitHub Actions workflow that installs and uses Visual Studio 2026:

yaml
name: Build with Visual Studio 2026

on:
 push:
 branches: [ main ]
 pull_request:
 branches: [ main ]

jobs:
 build:
 runs-on: windows-latest
 
 steps:
 - uses: actions/checkout@v4
 
 - name: Install Visual Studio 2026 Build Tools
 run: |
 choco install visualstudio2022buildtools --package-parameters "--add Microsoft.VisualStudio.Component.VC.Tools.x86.x64 --add Microsoft.VisualStudio.Component.Windows10SDK --add Microsoft.VisualStudio.Component.TestTools.BuildTools --includeOptional" -y
 
 - name: Add MSBuild to PATH
 run: |
 echo "C:\Program Files\Microsoft Visual Studio\2022\BuildTools\MSBuild\Current\Bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
 echo "C:\Program Files\Microsoft Visual Studio\2022\BuildTools\MSBuild\Current\Bin\amd64" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
 
 - name: Configure Visual Studio Environment
 run: |
 cmd /C "CALL `"C:\Program Files\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\Build\vcvars64.bat`" && set"
 
 - name: Build Solution
 run: msbuild yourproject.sln -p:Configuration=Release -p:Platform="x64" -p:VisualStudioVersion=18.0

Key Configuration Elements

MSBuild PATH Configuration: The step that adds MSBuild to PATH is crucial. Why? Because even though Visual Studio 2026 is installed, MSBuild might not be automatically added to the system PATH. This ensures that subsequent steps can find and execute MSBuild 18.

Visual Studio Environment Setup: The vcvars64.bat script sets up the necessary environment variables for Visual Studio builds. It configures include paths, library paths, and other compiler settings. Without this step, your builds might fail with “cannot find” errors.

Platform Specification: Notice how we explicitly specify the platform (x64 in this case) and configuration (Release). This prevents ambiguity and ensures consistent builds across different environments.

Advanced Configuration for Specific Requirements

For more complex scenarios, you might need additional configuration:

yaml
- name: Install Specific Visual Studio Components
 run: |
 choco install visualstudio2022-workload-vctools -y
 choco install visualstudio2022-workload-netweb -y
 
- name: Set .NET Environment Variables
 run: |
 echo "C:\Program Files\dotnet" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
 
- name: Build Multi‑Platform Solution
 run: |
 msbuild yourproject.sln `
 -p:Configuration=Release `
 -p:Platform="Any CPU" `
 -p:VisualStudioVersion=18.0 `
 -p:TargetFrameworkVersion="net8.0"

This example shows how to install additional workloads (like .NET web development) and configure for cross‑platform builds. The backticks (`) allow for multi‑line commands in YAML.

Advanced Configuration and Optimization

Caching Dependencies for Faster Builds

One of the biggest challenges with CI/CD pipelines is build time. You can significantly speed up Visual Studio 2026 builds on GitHub runners by implementing dependency caching:

yaml
- name: Cache NuGet packages
 uses: actions/cache@v3
 with:
 path: ~/.nuget/packages
 key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj') }}
 restore-keys: |
 ${{ runner.os }}-nuget-
yaml
- name: Cache npm packages
 uses: actions/cache@v3
 with:
 path: ~/.npm
 key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
 restore-keys: |
 ${{ runner.os }}-node-

Caching works by storing downloaded packages locally between runs. When the same package versions are needed again, they’re served from the cache instead of being downloaded anew.

Matrix Builds for Multiple Configurations

For comprehensive testing, you might want to build across multiple configurations:

yaml
jobs:
 build:
 runs-on: windows-latest
 strategy:
 matrix:
 configuration: [Debug, Release]
 platform: [x64, x86]
 exclude:
 - configuration: Debug
 platform: x86
 
 steps:
 - uses: actions/checkout@v4
 
 - name: Install Visual Studio 2026 Build Tools
 run: choco install visualstudio2022buildtools --package-parameters "--add Microsoft.VisualStudio.Component.VC.Tools.x86.x64 --add Microsoft.VisualStudio.Component.Windows10SDK" -y
 
 - name: Build Solution
 run: msbuild yourproject.sln -p:Configuration=${{ matrix.configuration }} -p:Platform=${{ matrix.platform }} -p:VisualStudioVersion=18.0

This matrix will create build jobs for Debug/x64 and Release/x64 (Debug/x86 is excluded as it’s rarely needed).

Parallel Execution with Job Dependencies

For large projects, you can split the build process into parallel jobs:

yaml
jobs:
 build:
 runs-on: windows-latest
 steps:
 - uses: actions/checkout@v4
 - name: Install Visual Studio 2026
 run: choco install visualstudio2022buildtools --package-parameters "--add Microsoft.VisualStudio.Component.VC.Tools.x86.x64" -y
 
 test:
 needs: build
 runs-on: windows-latest
 steps:
 - uses: actions/checkout@v4
 - name: Run Tests
 run: vstest.console.exe yourtests.dll --Framework:net8.0 --Platform:x64 --Configuration:Release

This approach allows you to run tests in parallel with other build steps, potentially reducing overall pipeline execution time.

Troubleshooting Common Issues

MSBuild Version Conflicts

You might encounter errors like “The imported project “Microsoft.Cpp.Default.props” was not found” or version mismatch issues. Here’s how to resolve them:

Problem: MSBuild can’t find the correct Visual Studio version
Solution: Explicitly specify the Visual Studio version in your build command:

yaml
- name: Build Solution
 run: msbuild yourproject.sln -p:VisualStudioVersion=18.0

PATH Issues

If you get “msbuild is not recognized” errors, the PATH configuration might be incorrect:

yaml
- name: Verify MSBuild Installation
 run: where msbuild

- name: Add MSBuild to PATH (Alternative Method)
 run: |
 $msbuildPath = "C:\Program Files\Microsoft Visual Studio\2022\BuildTools\MSBuild\Current\Bin"
 if (Test-Path $msbuildPath) {
 echo $msbuildPath | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
 echo "$msbuildPath\amd64" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
 } else {
 Write-Error "MSBuild not found at expected location"
 exit 1
 }

Component Installation Failures

Sometimes specific Visual Studio components fail to install. Here’s a more robust installation approach:

yaml
- name: Install Visual Studio 2026 with Retry
 run: |
 $maxRetries = 3
 $retryCount = 0
 $success = $false
 
 while ($retryCount -lt $maxRetries -and -not $success) {
 try {
 choco install visualstudio2022buildtools --package-parameters "--add Microsoft.VisualStudio.Component.VC.Tools.x86.x64 --add Microsoft.VisualStudio.Component.Windows10SDK --add Microsoft.VisualStudio.Component.TestTools.BuildTools --includeOptional" -y
 $success = $true
 Write-Host "Visual Studio installation succeeded"
 } catch {
 $retryCount++
 Write-Host "Visual Studio installation failed (attempt $retryCount of $maxRetries): $($_.Exception.Message)"
 if ($retryCount -lt $maxRetries) {
 Write-Host "Waiting 30 seconds before retry..."
 Start-Sleep -Seconds 30
 }
 }
 }
 
 if (-not $success) {
 Write-Error "Visual Studio installation failed after $maxRetries attempts"
 exit 1
 }

This includes retry logic and better error handling for unreliable network conditions.

Platform Toolset Issues

If you specifically need the v144 platform toolset, ensure you’re installing the correct components:

yaml
- name: Install v144 Platform Toolset
 run: |
 choco install visualstudio2022buildtools --package-parameters "--add Microsoft.VisualStudio.Component.VC.CMake.Project --add Microsoft.VisualStudio.Component.VC.Tools.x86.x64 --add Microsoft.VisualStudio.Component.Windows11SDK.22621 --add Microsoft.VisualStudio.Component.TestTools.BuildTools" -y
 
 # Verify toolset installation
 $toolsetPath = "C:\Program Files\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.40.33807"
 if (-not (Test-Path $toolsetPath)) {
 Write-Warning "v144 toolset not found at expected location. Installation may have failed."
 } else {
 Write-Host "v144 toolset verified at: $toolsetPath"
 }

Sources

  1. StackOverflow: Visual Studio 2026 Build Tools Installation — Side‑by‑side installation guide for GitHub runners: https://stackoverflow.com/questions/79852888/how-can-github-hosted-runners-use-visual-studio-2026-build-tools-msbuild-18-fo
  2. GitHub Official Changelog — Windows Server 2022 with Visual Studio 2022 availability announcement: https://github.blog/changelog/2021-11-16-github-actions-windows-server-2022-with-visual-studio-2022-is-now-generally-available-on-github-hosted-runners/
  3. StackOverflow: Optimizing VS Dependencies — Chocolatey installation approach for Visual Studio: https://stackoverflow.com/questions/77675533/optimizing-out-a-vs-2022-dependency-in-a-github-ci-action
  4. BiddyBytes Blog — Update on Visual Studio 2026 in GitHub Actions with Windows Server 2025: https://biddybytes.com/blog/update-visual-studio-2026-in
  5. Microsoft Learn — GitHub Actions integration with Visual Studio documentation: https://learn.microsoft.com/en-us/visualstudio/azure/overview-github-actions?view=vs-2022
  6. StackOverflow: VS Developer Command Prompt Setup — Environment configuration for GitHub Actions: https://stackoverflow.com/questions/76186423/how-to-setup-visual-studio-developer-command-prompt-on-github-actions
  7. StackOverflow: Build Installer with GitHub Actions — MSBuild configuration examples: https://stackoverflow.com/questions/71823928/build-installer-using-github-actions

Conclusion

Installing Visual Studio 2026 on GitHub runners is entirely achievable through side‑by‑side installation using Chocolatey, providing you with MSBuild 18 and the v144 platform toolset while maintaining compatibility with existing Visual Studio 2022 installations. The process involves installing the Visual Studio 2022 Build Tools package through Chocolatey, which will automatically install the latest available version, and then properly configuring the environment variables and PATH settings in your GitHub Actions workflow.

As GitHub transitions to Windows Server 2025 runner images, Visual Studio 2026 will become available by default, simplifying the setup process. Until then, the Chocolatey approach offers a reliable, repeatable method for ensuring your CI/CD pipelines have access to the latest Microsoft development tools. By following the configuration steps and troubleshooting guidance provided, you can successfully build applications that require Visual Studio 2026 features on GitHub Actions runners, maintaining parity between your local development environment and your continuous integration pipeline.

Authors
Verified by moderation
Moderation
Installing Visual Studio 2026 on GitHub Runners