@echo off setlocal set "ROOT=%~dp0.." set "SOLUTION=%ROOT%\BizTalkSuspendedInstancesCheck.sln" if not defined MSBUILD ( set "VSWHERE=%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" if exist "%VSWHERE%" ( for /f "usebackq tokens=*" %%i in (`"%VSWHERE%" -latest -requires Microsoft.Component.MSBuild -find MSBuild\**\Bin\MSBuild.exe`) do ( set "MSBUILD=%%i" goto :found_msbuild ) ) ) :found_msbuild if not defined MSBUILD ( for /f "tokens=*" %%i in ('where msbuild 2^>nul') do ( set "MSBUILD=%%i" goto :found_msbuild_path ) ) :found_msbuild_path if not defined MSBUILD ( echo MSBuild was not found. Install Visual Studio Build Tools and the .NET Framework 4.6.1 Developer Pack. exit /b 1 ) echo Using MSBuild: %MSBUILD% "%MSBUILD%" "%SOLUTION%" /m /restore /p:Configuration=Release /p:Platform="Any CPU" exit /b %ERRORLEVEL%