C:\BuildTools\MSBuild\Current\Bin\MSBuild.exe Build your solution:
"Build Tools = compilers + MSBuild – the kitchen sink." Did this help you? Let me know your favorite Build Tools 2022 tips in the comments. microsoft build tools 2022
I’ve structured it for a developer audience (CI/CD engineers, C++ devs, .NET devs without full VS). It’s practical, actionable, and highlights common pitfalls. If you maintain build servers, Docker images, or just hate installing the full Visual Studio IDE just to compile code, Microsoft Build Tools 2022 is your best friend. C:\BuildTools\MSBuild\Current\Bin\MSBuild
$msbuild = "C:\BuildTools\MSBuild\Current\Bin\MSBuild.exe" & $msbuild -version It’s practical, actionable, and highlights common pitfalls
You get a vs_BuildTools.exe (~2 MB bootstrapper). vs_BuildTools.exe --quiet --wait --norestart --installPath C:\BuildTools ` --add Microsoft.VisualStudio.Workload.MSBuildTools ` --add Microsoft.VisualStudio.Workload.VCTools ` --add Microsoft.VisualStudio.Component.VC.Tools.x86.x64 ` --add Microsoft.VisualStudio.Component.Windows10SDK.20348 ` --includeRecommended Workload IDs for common scenarios:
For C++:
# For x64 native & "C:\BuildTools\VC\Auxiliary\Build\vcvars64.bat" cl.exe /EHsc /Fe:hello.exe hello.cpp FROM mcr.microsoft.com/windows/servercore:ltsc2022 AS build ADD https://aka.ms/vs/17/release/vs_buildtools.exe vs_buildtools.exe RUN vs_buildtools.exe --quiet --wait --norestart --installPath C:\BuildTools ` --add Microsoft.VisualStudio.Workload.VCTools ` --add Microsoft.VisualStudio.Component.Windows10SDK.20348 WORKDIR C:\src COPY . . RUN C:\BuildTools\MSBuild\Current\Bin\MSBuild.exe MyApp.sln Pitfalls to Avoid (Saves Hours) | Pitfall | Solution | |---------|----------| | Missing SDK | Build fails with "windows.h not found" . Explicitly add the Windows SDK component. | | Path too long | Install to C:\BuildTools (not Program Files ). Long paths break older projects. | | No vswhere.exe | Unlike full VS, Build Tools alone may lack vswhere . Install Microsoft.VisualStudio.Component.VC.CMake.Project if you need instance detection. | | Running in PowerShell without --wait | Installer returns immediately → build runs against incomplete tools. Always use Start-Process -Wait or the --wait flag. | Verifying Your Installation Run this quick check after install: