deploy-msbuild-to-vs

Deploy locally-built MSBuild binaries into a Visual Studio installation for testing and debugging.

1.2k|337|Updated Oct 13, 2022
One-click install
npx skills add https://github.com/dotnet/dotnet --skill deploy-msbuild-to-vs
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: deploy-msbuild-to-vs
Source: https://github.com/dotnet/dotnet/tree/main/src/msbuild/.github/skills/deploy-msbuild-to-vs
Command: npx skills add https://github.com/dotnet/dotnet --skill deploy-msbuild-to-vs

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Testing MSBuild changes inside Visual Studio normally requires a full VS insertion cycle, making it hard to verify local fixes against real solutions or debug MSBuild when invoked by devenv.exe. This Skill walks you through replacing VS's bundled MSBuild with your locally-built binaries, capturing binary logs, and restoring the original state safely.

Core Features & Use Cases

  • Guided Deployment: Step-by-step instructions to build MSBuild, locate the correct VS MSBuild Bin folder with vswhere, and run the Deploy-MSBuild.ps1 script with the right parameters.
  • In-VS Debugging: Configure environment variables like MSBuildDebugBuildManagerOnStart and MSBuildDebugEngine to break into the debugger or capture full binary logs from design-time and real builds inside VS.
  • Backup and Restore: Automatic timestamped backups plus recovery guidance via backup folders or VS Installer Repair if something goes wrong.
  • Use Case: You fixed an MSBuild evaluation bug and want to confirm it resolves a customer solution that only reproduces through Visual Studio builds. Build the repo, deploy to your VS 2022 Enterprise Bin folder, reopen VS, and capture a binlog to verify the fix.

Quick Start

Deploy my locally built MSBuild into my Visual Studio 2022 installation so I can test my changes from within VS.

Frequently Asked Questions about deploy-msbuild-to-vs

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I test local MSBuild changes inside Visual Studio?

Build MSBuild with build.cmd, then run Deploy-MSBuild.ps1 from an administrator PowerShell pointing at your VS MSBuild Bin folder. Close and reopen Visual Studio so it picks up the replaced binaries, then build a solution to verify your changes.

How to debug MSBuild when it runs inside Visual Studio?

Set the MSBuildDebugBuildManagerOnStart environment variable to 1 or 2 and MSBuildDebugProcessName to devenv before launching devenv.exe. This triggers a debugger break at BuildManager.BeginBuild, where VS calls into the MSBuild API.

How do I find the MSBuild Bin folder for my Visual Studio installation?

Use vswhere.exe from the Visual Studio Installer folder to list installations and get the installationPath, then append MSBuild\Current\Bin. The path follows the pattern Program Files\Microsoft Visual Studio\{version}\{edition}\MSBuild\Current\Bin.

Can I deploy MSBuild to the .NET SDK instead of Visual Studio?

Yes, run Deploy-MSBuild.ps1 with the destination set to the SDK folder such as C:\Program Files\dotnet\sdk\10.0.100 and pass -runtime Core. The script also auto-detects SDK paths containing dotnet and sdk.

What happens if Visual Studio breaks after deploying custom MSBuild?

The deploy script creates a timestamped Backup folder in the destination by default, so you can copy the original files back. Alternatively, run Visual Studio Installer and choose Modify then Repair to fully restore the original binaries.

Why are my MSBuild changes not showing up in Visual Studio builds?

Visual Studio caches MSBuild on startup, so close all VS instances and kill lingering MSBuild.exe processes before rebuilding. Also confirm the -configuration parameter matches the configuration you passed to build.cmd.