diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 0000000000..9893d82d47 --- /dev/null +++ b/AGENTS.md @@ -0,0 +1,57 @@ +# Repository Guidelines + +## Environment +- OS: Windows +- Shell: Use Command Prompt (`cmd.exe`) only; avoid Bash/Unix commands +- Tools: Visual Studio 2022 (v17) and appropriate .NET SDKs starting with `net472` +- Build scripts are Windows `.cmd` files under `Scripts/` +- Do not run build scripts unless instructed to do so + +## Project Structure & Module Organization +- `Source/Krypton Components`: Core libraries (`Krypton.Toolkit`, `Krypton.Ribbon`, `Krypton.Navigator`, `Krypton.Workspace`, `Krypton.Docking`) and the solution `Krypton Toolkit Suite 2022 - VS2022.sln` +- `Source/Krypton Components/TestForm`: WinForms sample app used to validate changes +- `Source/TestHarnesses`: Small repro/test harnesses (e.g., `ThemeSwapRepro`) +- `Scripts/`: Build and packaging scripts (`build-stable.cmd`, `build-canary.cmd`, `build-nightly.cmd`, `build.proj`) +- `Bin/`: Build outputs by configuration (e.g., `Bin/Debug`) +- `Documents/`, `Assets/`, `Logs/`: Docs, images, and build logs + +## Build, Test, and Development Commands +- Build solution (Debug): + - `dotnet build "Source/Krypton Components/Krypton Toolkit Suite 2022 - VS2022.sln" -c Debug` +- Run sample app: + - `dotnet run --project "Source/Krypton Components/TestForm/TestForm.csproj" -c Debug` +- Preset builds (Windows cmd): + - `Scripts/build-stable.cmd` | `Scripts/build-canary.cmd` | `Scripts/build-nightly.cmd` +- Build scripts locate MSBuild via `Scripts\Common\find-msbuild.cmd` (`vswhere.exe`, then standard install paths). Profiles: `2019`, `2022`, `current` (newest VS major 18+), or a pinned major (`18`, `19`, …). `Scripts\Current\` uses `current`. Override with `MSBUILDPATH` or `MSBUILD_PATH` pointing at `MSBuild\Current\Bin`. +- Outputs land in `Bin//`. VS2019/full MSBuild builds only .NET Framework 4.x TFMs; supported TFMs include `net472`, `net48`, `net481`, `net8.0-windows`, `net9.0-windows`, `net10.0-windows` + +## Coding Style & Naming Conventions +- Line endings/encoding: CRLF, UTF-8 with BOM +- Follow `Source/.editorconfig` and project analyzers (`EnableNETAnalyzers=true`) +- Indentation: 4 spaces; line endings: CRLF +- Projects use `global using` like in GlobalDeclarations.cs, do not add new usings in other files +- Before adding new variables check for existing ones +- No variable aliasing +- New files must use only the current Standard Toolkit BSD header. Do not add the original ComponentFactory BSD header unless the file is derived from original ComponentFactory source. + +## C# Rules +- Surgical edits: preserve structure, identifiers, and existing comments; avoid adding defensive checks unless asked +- No unneeded `try/catch` blocks if there's no catch handling +- Idioms: use null-propagation and object/collection initializers where consistent +- Fix compiler, analyzer, and IDE warnings in new or modified code before handing work back +- Prefer switch expressions for simple value/type dispatch that only returns a value; keep switch statements for complex control flow or side effects +- Compatibility: ensure changes build for `net472` and C# 7.3 +- WinForms: `UseWindowsForms=true`; prefer designer-friendly patterns and keep partial classes tidy +- WinForms designer: keep object declarations at file bottom; initialize in `*.Designer.cs` `InitializeComponent()` +- Constraint: do not use `yield return` inside `catch` blocks + +## Testing Guidelines +- No formal unit test suite. Validate changes via `TestForm` scenarios and harnesses under `Source/TestHarnesses` +- When fixing a bug, add/adjust a minimal repro in `TestForm` or a harness and describe manual steps in the PR + +## Commit & Pull Request Guidelines +- Commits: short, imperative subject; reference issues/PRs (e.g., `Fix autosizing (#2433)` or `2439 V100 datecell autosizing`) +- PRs: clear description, linked issues, screenshots/gifs for UI changes, notes on breaking changes/TFM impact + +## Security & Configuration Tips +- Windows long paths must be enabled to build locally (see README link). Build on Windows for `-windows` TFMs diff --git a/Documents/Help/Changelog.md b/Documents/Help/Changelog.md index 8a979b511e..e5fcc89332 100644 --- a/Documents/Help/Changelog.md +++ b/Documents/Help/Changelog.md @@ -2,6 +2,12 @@ ======= +# 2026-08-24 - Build 2608 (Patch 12) - August 2026 + +* Implemented [#3788](https://github.com/Krypton-Suite/Standard-Toolkit/issues/3788), Allow build scripts to find Visual Studio. Build scripts locate Visual Studio/MSBuild via `Scripts/Common/find-msbuild.cmd` (`vswhere.exe`, `current` profile for yearly VS 18+, custom install paths and non-default drives); override with `MSBUILDPATH` or `MSBUILD_PATH`. Build scripts and ModernBuild locate MSBuild via `Scripts/Common/find-msbuild.cmd` and `vswhere.exe`, with `%ProgramFiles%` fallback and `MSBUILDPATH` / `MSBUILD_PATH` overrides for custom or non-system-drive Visual Studio installs + +======= + # 2026-06-22 - Build 2606 (Patch 11) - June 2026 * Resolved [#3661](https://github.com/Krypton-Suite/Standard-Toolkit/issues/3661), KContextMenu items overflow not visible diff --git a/Scripts/Build/build-canary.cmd b/Scripts/Build/build-canary.cmd index 57f8eea50d..0231aead4b 100644 --- a/Scripts/Build/build-canary.cmd +++ b/Scripts/Build/build-canary.cmd @@ -1,37 +1,16 @@ @echo off +REM Canary release build using the Scripts/Build/ toolset (Visual Studio 2019, profile "2019") +REM MSBuild discovery: Scripts\Common\find-msbuild.cmd. Failure text comes from the helper; this script only pauses. setlocal EnableExtensions set "SCRIPT_DIR=%~dp0" pushd "%SCRIPT_DIR%" -if exist "%ProgramFiles%\Microsoft Visual Studio\18\Insiders\MSBuild\Current\Bin" goto vscurrentinsiders -if exist "%ProgramFiles%\Microsoft Visual Studio\18\Enterprise\MSBuild\Current\Bin" goto vscurrentent -if exist "%ProgramFiles%\Microsoft Visual Studio\18\Professional\MSBuild\Current\Bin" goto vscurrentpro -if exist "%ProgramFiles%\Microsoft Visual Studio\18\Community\MSBuild\Current\Bin" goto vscurrentcom -if exist "%ProgramFiles%\Microsoft Visual Studio\18\BuildTools\MSBuild\Current\Bin" goto vscurrentbuild - -echo "Unable to detect suitable environment. Check if VS 2026 is installed." +call "%SCRIPT_DIR%..\Common\find-msbuild.cmd" 2019 +if errorlevel 1 ( echo. pause goto exitbatch - -:vscurrentinsiders -set "msbuildpath=%ProgramFiles%\Microsoft Visual Studio\18\Insiders\MSBuild\Current\Bin" -goto build - -:vscurrentent -set "msbuildpath=%ProgramFiles%\Microsoft Visual Studio\18\Enterprise\MSBuild\Current\Bin" -goto build - -:vscurrentpro -set "msbuildpath=%ProgramFiles%\Microsoft Visual Studio\18\Professional\MSBuild\Current\Bin" -goto build - -:vscurrentcom -set "msbuildpath=%ProgramFiles%\Microsoft Visual Studio\18\Community\MSBuild\Current\Bin" -goto build - -:vscurrentbuild -set "msbuildpath=%ProgramFiles%\Microsoft Visual Studio\18\BuildTools\MSBuild\Current\Bin" +) goto build :build @@ -45,7 +24,8 @@ for /f "tokens=* usebackq" %%A in (`tzutil /g`) do ( @echo: set "targets=Build" if not "%~1" == "" set "targets=%~1" -"%msbuildpath%\msbuild.exe" /t:%targets% "%SCRIPT_DIR%canary.proj" /fl /flp:logfile="%SCRIPT_DIR%..\..\Logs\canary-build-log.log" /bl:"%SCRIPT_DIR%..\..\Logs\canary-build-log.binlog" /clp:Summary;ShowTimestamp /v:quiet +REM Phased Krypton.* build + /m (see Scripts\Build\Krypton.Orchestration.targets). +"%msbuildpath%\msbuild.exe" /m /t:%targets% "%SCRIPT_DIR%canary.proj" /fl /flp:logfile="%SCRIPT_DIR%..\..\Logs\canary-build-log.log" /bl:"%SCRIPT_DIR%..\..\Logs\canary-build-log.binlog" /clp:Summary;ShowTimestamp /v:quiet @echo: @echo Canary release build completed: %date% %time% %zone% @echo: diff --git a/Scripts/Build/build-installer.cmd b/Scripts/Build/build-installer.cmd index 68e491af31..e3d24eee9c 100644 --- a/Scripts/Build/build-installer.cmd +++ b/Scripts/Build/build-installer.cmd @@ -1,37 +1,16 @@ @echo off +REM Installer package build using the Scripts/Build/ toolset (Visual Studio 2019, profile "2019") +REM MSBuild discovery: Scripts\Common\find-msbuild.cmd. Failure text comes from the helper; this script only pauses. setlocal EnableExtensions set "SCRIPT_DIR=%~dp0" pushd "%SCRIPT_DIR%" -if exist "%ProgramFiles%\Microsoft Visual Studio\18\Insiders\MSBuild\Current\Bin" goto vscurrentinsiders -if exist "%ProgramFiles%\Microsoft Visual Studio\18\Enterprise\MSBuild\Current\Bin" goto vscurrentent -if exist "%ProgramFiles%\Microsoft Visual Studio\18\Professional\MSBuild\Current\Bin" goto vscurrentpro -if exist "%ProgramFiles%\Microsoft Visual Studio\18\Community\MSBuild\Current\Bin" goto vscurrentcom -if exist "%ProgramFiles%\Microsoft Visual Studio\18\BuildTools\MSBuild\Current\Bin" goto vscurrentbuild - -echo "Unable to detect suitable environment. Check if VS 2026 is installed." +call "%SCRIPT_DIR%..\Common\find-msbuild.cmd" 2019 +if errorlevel 1 ( echo. pause goto exitbatch - -:vscurrentinsiders -set "msbuildpath=%ProgramFiles%\Microsoft Visual Studio\18\Insiders\MSBuild\Current\Bin" -goto build - -:vscurrentent -set "msbuildpath=%ProgramFiles%\Microsoft Visual Studio\18\Enterprise\MSBuild\Current\Bin" -goto build - -:vscurrentpro -set "msbuildpath=%ProgramFiles%\Microsoft Visual Studio\18\Professional\MSBuild\Current\Bin" -goto build - -:vscurrentcom -set "msbuildpath=%ProgramFiles%\Microsoft Visual Studio\18\Community\MSBuild\Current\Bin" -goto build - -:vscurrentbuild -set "msbuildpath=%ProgramFiles%\Microsoft Visual Studio\18\BuildTools\MSBuild\Current\Bin" +) goto build :build @@ -43,7 +22,8 @@ for /f "tokens=* usebackq" %%A in (`tzutil /g`) do ( @echo set "targets=Build" if not "%~1" == "" set "targets=%~1" -"%msbuildpath%\msbuild.exe" /t:%targets% "%SCRIPT_DIR%..\Project Files\installer.proj" /fl /flp:logfile="%SCRIPT_DIR%..\..\Logs\installer-build-log.log" /bl:"%SCRIPT_DIR%..\..\Logs\installer-build-log.binlog" /clp:Summary;ShowTimestamp /v:quiet +REM /m: multi-processor MSBuild (all logical CPUs). +"%msbuildpath%\msbuild.exe" /m /t:%targets% "%SCRIPT_DIR%..\Project Files\installer.proj" /fl /flp:logfile="%SCRIPT_DIR%..\..\Logs\installer-build-log.log" /bl:"%SCRIPT_DIR%..\..\Logs\installer-build-log.binlog" /clp:Summary;ShowTimestamp /v:quiet @echo Build Completed: %date% %time% %zone% diff --git a/Scripts/Build/build-lts.cmd b/Scripts/Build/build-lts.cmd index 9179183a25..9373a5626a 100644 --- a/Scripts/Build/build-lts.cmd +++ b/Scripts/Build/build-lts.cmd @@ -1,37 +1,16 @@ @echo off +REM Long-term stable build using the Scripts/Build/ toolset (Visual Studio 2019, profile "2019") +REM MSBuild discovery: Scripts\Common\find-msbuild.cmd. Failure text comes from the helper; this script only pauses. setlocal EnableExtensions set "SCRIPT_DIR=%~dp0" pushd "%SCRIPT_DIR%" -if exist "%ProgramFiles%\Microsoft Visual Studio\18\Insiders\MSBuild\Current\Bin" goto vscurrentinsiders -if exist "%ProgramFiles%\Microsoft Visual Studio\18\Enterprise\MSBuild\Current\Bin" goto vscurrentent -if exist "%ProgramFiles%\Microsoft Visual Studio\18\Professional\MSBuild\Current\Bin" goto vscurrentpro -if exist "%ProgramFiles%\Microsoft Visual Studio\18\Community\MSBuild\Current\Bin" goto vscurrentcom -if exist "%ProgramFiles%\Microsoft Visual Studio\18\BuildTools\MSBuild\Current\Bin" goto vscurrentbuild - -echo "Unable to detect suitable environment. Check if VS 2026 is installed." +call "%SCRIPT_DIR%..\Common\find-msbuild.cmd" 2019 +if errorlevel 1 ( echo. pause goto exitbatch - -:vscurrentinsiders -set "msbuildpath=%ProgramFiles%\Microsoft Visual Studio\18\Insiders\MSBuild\Current\Bin" -goto build - -:vscurrentent -set "msbuildpath=%ProgramFiles%\Microsoft Visual Studio\18\Enterprise\MSBuild\Current\Bin" -goto build - -:vscurrentpro -set "msbuildpath=%ProgramFiles%\Microsoft Visual Studio\18\Professional\MSBuild\Current\Bin" -goto build - -:vscurrentcom -set "msbuildpath=%ProgramFiles%\Microsoft Visual Studio\18\Community\MSBuild\Current\Bin" -goto build - -:vscurrentbuild -set "msbuildpath=%ProgramFiles%\Microsoft Visual Studio\18\BuildTools\MSBuild\Current\Bin" +) goto build :build @@ -45,7 +24,8 @@ for /f "tokens=* usebackq" %%A in (`tzutil /g`) do ( @echo: set "targets=Build" if not "%~1" == "" set "targets=%~1" -"%msbuildpath%\msbuild.exe" /t:%targets% "%SCRIPT_DIR%longtermstable.proj" /fl /flp:logfile="%SCRIPT_DIR%..\..\Logs\long-term-stable-build-log.log" /bl:"%SCRIPT_DIR%..\..\Logs\long-term-stable-build-log.binlog" /clp:Summary;ShowTimestamp /v:quiet +REM Phased Krypton.* build + /m (see Scripts\Build\Krypton.Orchestration.targets). +"%msbuildpath%\msbuild.exe" /m /t:%targets% "%SCRIPT_DIR%longtermstable.proj" /fl /flp:logfile="%SCRIPT_DIR%..\..\Logs\long-term-stable-build-log.log" /bl:"%SCRIPT_DIR%..\..\Logs\long-term-stable-build-log.binlog" /clp:Summary;ShowTimestamp /v:quiet @echo: @echo Stable release build completed: %date% %time% %zone% @echo: diff --git a/Scripts/Build/build-nightly-custom.cmd b/Scripts/Build/build-nightly-custom.cmd index 44ce78f0d3..b2c2b75443 100644 --- a/Scripts/Build/build-nightly-custom.cmd +++ b/Scripts/Build/build-nightly-custom.cmd @@ -1,37 +1,16 @@ @echo off +REM Nightly custom-target build using the Scripts/Build/ toolset (Visual Studio 2019, profile "2019") +REM MSBuild discovery: Scripts\Common\find-msbuild.cmd. Failure text comes from the helper; this script only pauses. setlocal EnableExtensions set "SCRIPT_DIR=%~dp0" pushd "%SCRIPT_DIR%" -if exist "%ProgramFiles%\Microsoft Visual Studio\18\Insiders\MSBuild\Current\Bin" goto vscurrentinsiders -if exist "%ProgramFiles%\Microsoft Visual Studio\18\Enterprise\MSBuild\Current\Bin" goto vscurrentent -if exist "%ProgramFiles%\Microsoft Visual Studio\18\Professional\MSBuild\Current\Bin" goto vscurrentpro -if exist "%ProgramFiles%\Microsoft Visual Studio\18\Community\MSBuild\Current\Bin" goto vscurrentcom -if exist "%ProgramFiles%\Microsoft Visual Studio\18\BuildTools\MSBuild\Current\Bin" goto vscurrentbuild - -echo "Unable to detect suitable environment. Check if VS 2026 is installed." +call "%SCRIPT_DIR%..\Common\find-msbuild.cmd" 2019 +if errorlevel 1 ( echo. pause goto exitbatch - -:vscurrentinsiders -set "msbuildpath=%ProgramFiles%\Microsoft Visual Studio\18\Insiders\MSBuild\Current\Bin" -goto build - -:vscurrentent -set "msbuildpath=%ProgramFiles%\Microsoft Visual Studio\18\Enterprise\MSBuild\Current\Bin" -goto build - -:vscurrentpro -set "msbuildpath=%ProgramFiles%\Microsoft Visual Studio\18\Professional\MSBuild\Current\Bin" -goto build - -:vscurrentcom -set "msbuildpath=%ProgramFiles%\Microsoft Visual Studio\18\Community\MSBuild\Current\Bin" -goto build - -:vscurrentbuild -set "msbuildpath=%ProgramFiles%\Microsoft Visual Studio\18\BuildTools\MSBuild\Current\Bin" +) goto build :build @@ -43,7 +22,7 @@ for /f "tokens=* usebackq" %%A in (`tzutil /g`) do ( @echo set "targets=Build" if not "%~1" == "" set "targets=%~1" -"%msbuildpath%\msbuild.exe" /t:%targets% "%SCRIPT_DIR%nightly.proj" /fl /flp:logfile="%SCRIPT_DIR%..\..\build.log" +"%msbuildpath%\msbuild.exe" /m /t:%targets% "%SCRIPT_DIR%nightly.proj" /fl /flp:logfile="%SCRIPT_DIR%..\..\build.log" @echo Build Completed: %date% %time% %zone% diff --git a/Scripts/Build/build-nightly.cmd b/Scripts/Build/build-nightly.cmd index 28050d57e4..f037d2ea7d 100644 --- a/Scripts/Build/build-nightly.cmd +++ b/Scripts/Build/build-nightly.cmd @@ -1,37 +1,16 @@ @echo off +REM Nightly release build using the Scripts/Build/ toolset (Visual Studio 2019, profile "2019") +REM MSBuild discovery: Scripts\Common\find-msbuild.cmd. Failure text comes from the helper; this script only pauses. setlocal EnableExtensions set "SCRIPT_DIR=%~dp0" pushd "%SCRIPT_DIR%" -if exist "%ProgramFiles%\Microsoft Visual Studio\18\Insiders\MSBuild\Current\Bin" goto vscurrentinsiders -if exist "%ProgramFiles%\Microsoft Visual Studio\18\Enterprise\MSBuild\Current\Bin" goto vscurrentent -if exist "%ProgramFiles%\Microsoft Visual Studio\18\Professional\MSBuild\Current\Bin" goto vscurrentpro -if exist "%ProgramFiles%\Microsoft Visual Studio\18\Community\MSBuild\Current\Bin" goto vscurrentcom -if exist "%ProgramFiles%\Microsoft Visual Studio\18\BuildTools\MSBuild\Current\Bin" goto vscurrentbuild - -echo "Unable to detect suitable environment. Check if VS 2026 is installed." - +call "%SCRIPT_DIR%..\Common\find-msbuild.cmd" 2019 +if errorlevel 1 ( +echo. pause goto exitbatch - -:vscurrentinsiders -set "msbuildpath=%ProgramFiles%\Microsoft Visual Studio\18\Insiders\MSBuild\Current\Bin" -goto build - -:vscurrentent -set "msbuildpath=%ProgramFiles%\Microsoft Visual Studio\18\Enterprise\MSBuild\Current\Bin" -goto build - -:vscurrentpro -set "msbuildpath=%ProgramFiles%\Microsoft Visual Studio\18\Professional\MSBuild\Current\Bin" -goto build - -:vscurrentcom -set "msbuildpath=%ProgramFiles%\Microsoft Visual Studio\18\Community\MSBuild\Current\Bin" -goto build - -:vscurrentbuild -set "msbuildpath=%ProgramFiles%\Microsoft Visual Studio\18\BuildTools\MSBuild\Current\Bin" +) goto build :build @@ -39,13 +18,14 @@ for /f "tokens=* usebackq" %%A in (`tzutil /g`) do ( set "zone=%%A" ) +REM Phased Krypton.* build + /m (see Scripts\Build\Krypton.Orchestration.targets). @echo Started to build Nightly release @echo: @echo Started: %date% %time% %zone% @echo: set "targets=Build" if not "%~1" == "" set "targets=%~1" -"%msbuildpath%\msbuild.exe" -t:%targets% "%SCRIPT_DIR%nightly.proj" /fl /flp:logfile="%SCRIPT_DIR%..\..\Logs\nightly-build-log.log" /bl:"%SCRIPT_DIR%..\..\Logs\nightly-build-log.binlog" /clp:Summary;ShowTimestamp /v:quiet +"%msbuildpath%\msbuild.exe" /m -t:%targets% "%SCRIPT_DIR%nightly.proj" /fl /flp:logfile="%SCRIPT_DIR%..\..\Logs\nightly-build-log.log" /bl:"%SCRIPT_DIR%..\..\Logs\nightly-build-log.binlog" /clp:Summary;ShowTimestamp /v:quiet @echo: :: -t:rebuild diff --git a/Scripts/Build/build-stable.cmd b/Scripts/Build/build-stable.cmd index ec326062f7..d94156aa83 100644 --- a/Scripts/Build/build-stable.cmd +++ b/Scripts/Build/build-stable.cmd @@ -1,37 +1,16 @@ @echo off +REM Stable release build using the Scripts/Build/ toolset (Visual Studio 2019, profile "2019") +REM MSBuild discovery: Scripts\Common\find-msbuild.cmd. Failure text comes from the helper; this script only pauses. setlocal EnableExtensions set "SCRIPT_DIR=%~dp0" pushd "%SCRIPT_DIR%" -if exist "%ProgramFiles%\Microsoft Visual Studio\18\Insiders\MSBuild\Current\Bin" goto vscurrentinsiders -if exist "%ProgramFiles%\Microsoft Visual Studio\18\Enterprise\MSBuild\Current\Bin" goto vscurrentent -if exist "%ProgramFiles%\Microsoft Visual Studio\18\Professional\MSBuild\Current\Bin" goto vscurrentpro -if exist "%ProgramFiles%\Microsoft Visual Studio\18\Community\MSBuild\Current\Bin" goto vscurrentcom -if exist "%ProgramFiles%\Microsoft Visual Studio\18\BuildTools\MSBuild\Current\Bin" goto vscurrentbuild - -echo "Unable to detect suitable environment. Check if VS 2026 is installed." +call "%SCRIPT_DIR%..\Common\find-msbuild.cmd" 2019 +if errorlevel 1 ( echo. pause goto exitbatch - -:vscurrentinsiders -set "msbuildpath=%ProgramFiles%\Microsoft Visual Studio\18\Insiders\MSBuild\Current\Bin" -goto build - -:vscurrentent -set "msbuildpath=%ProgramFiles%\Microsoft Visual Studio\18\Enterprise\MSBuild\Current\Bin" -goto build - -:vscurrentpro -set "msbuildpath=%ProgramFiles%\Microsoft Visual Studio\18\Professional\MSBuild\Current\Bin" -goto build - -:vscurrentcom -set "msbuildpath=%ProgramFiles%\Microsoft Visual Studio\18\Community\MSBuild\Current\Bin" -goto build - -:vscurrentbuild -set "msbuildpath=%ProgramFiles%\Microsoft Visual Studio\18\BuildTools\MSBuild\Current\Bin" +) goto build :build @@ -45,7 +24,8 @@ for /f "tokens=* usebackq" %%A in (`tzutil /g`) do ( @echo: set "targets=Build" if not "%~1" == "" set "targets=%~1" -"%msbuildpath%\msbuild.exe" /t:%targets% "%SCRIPT_DIR%build.proj" /fl /flp:logfile="%SCRIPT_DIR%..\..\Logs\stable-build-log.log" /bl:"%SCRIPT_DIR%..\..\Logs\stable-build-log.binlog" /clp:Summary;ShowTimestamp /v:quiet +REM Phased Krypton.* build + /m (see Scripts\Build\Krypton.Orchestration.targets). +"%msbuildpath%\msbuild.exe" /m /t:%targets% "%SCRIPT_DIR%build.proj" /fl /flp:logfile="%SCRIPT_DIR%..\..\Logs\stable-build-log.log" /bl:"%SCRIPT_DIR%..\..\Logs\stable-build-log.binlog" /clp:Summary;ShowTimestamp /v:quiet @echo: @echo Stable release build completed: %date% %time% %zone% @echo: diff --git a/Scripts/Build/buildsolution.cmd b/Scripts/Build/buildsolution.cmd index 1cd6270e2e..19b2671cd9 100644 --- a/Scripts/Build/buildsolution.cmd +++ b/Scripts/Build/buildsolution.cmd @@ -1,112 +1,88 @@ echo off +setlocal EnableExtensions +set "SCRIPT_DIR=%~dp0" +pushd "%SCRIPT_DIR%" echo Do you want to build using Visual Studio 2019 or 2026? (2019/2026) set INPUT= -set /P INPUT=Type 2019 or 2026: %=% +set /P "INPUT=Type 2019 or 2026: " if /I "%INPUT%"=="2019" goto vs2019build if /I "%INPUT%"=="2026" goto vs2026build +goto exitbatch :vs2019build -if exist "%ProgramFiles(x86)%\Microsoft Visual Studio\2019\Insiders\MSBuild\Current\Bin" goto vs16prev -if exist "%ProgramFiles(x86)%\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin" goto vs16ent -if exist "%ProgramFiles(x86)%\Microsoft Visual Studio\2019\Professional\MSBuild\Current\Bin" goto vs16pro -if exist "%ProgramFiles(x86)%\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin" goto vs16com -if exist "%ProgramFiles(x86)%\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin" goto vs16build - -echo "Unable to detect suitable environment. Check if VS 2019 is installed." - +call "%SCRIPT_DIR%..\Common\find-msbuild.cmd" 2019 +if errorlevel 1 ( +echo. pause - goto exitbatch - -:vs16prev -set msbuildpath=%ProgramFiles(x86)%\Microsoft Visual Studio\2019\Insiders\MSBuild\Current\Bin -goto build2019 - -:vs16ent -set msbuildpath=%ProgramFiles(x86)%\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin -goto build2019 - -:vs16pro -set msbuildpath=%ProgramFiles(x86)%\Microsoft Visual Studio\2019\Professional\MSBuild\Current\Bin -goto build2019 - -:vs16com -set msbuildpath=%ProgramFiles(x86)%\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin -goto build2019 - -:vs16build -set msbuildpath=%ProgramFiles(x86)%\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin +) goto build2019 :build2019 @echo Started: %date% %time% @echo -set targets=Build -if not "%~1" == "" set targets=%~1 -"%msbuildpath%\msbuild.exe" /t:%targets% build.proj /fl /flp:logfile=../Logs/solution-build-log.log /bl:solution-build-log.binlog /clp:Summary;ShowTimestamp /v:quiet +if "%targets%" == "" set "targets=Build" +if not "%~1" == "" set "targets=%~1" +REM /m: multi-processor MSBuild (all logical CPUs). +"%msbuildpath%\msbuild.exe" /m /t:%targets% "%SCRIPT_DIR%build.proj" /fl /flp:logfile="%SCRIPT_DIR%..\..\Logs\solution-build-log.log" /bl:"%SCRIPT_DIR%..\..\Logs\solution-build-log.binlog" /clp:Summary;ShowTimestamp /v:quiet +if "%afterpack%" == "1" goto packdone +goto postbuild :vs2026build -if exist "%ProgramFiles%\Microsoft Visual Studio\18\Insiders\MSBuild\Current\Bin" goto vscurrentinsiders -if exist "%ProgramFiles%\Microsoft Visual Studio\18\Enterprise\MSBuild\Current\Bin" goto vscurrentent -if exist "%ProgramFiles%\Microsoft Visual Studio\18\Professional\MSBuild\Current\Bin" goto vscurrentpro -if exist "%ProgramFiles%\Microsoft Visual Studio\18\Community\MSBuild\Current\Bin" goto vscurrentcom -if exist "%ProgramFiles%\Microsoft Visual Studio\18\BuildTools\MSBuild\Current\Bin" goto vscurrentbuild - -echo "Unable to detect suitable environment. Check if VS 2026 is installed." -goto exitbatch +call "%SCRIPT_DIR%..\Common\find-msbuild.cmd" current +if errorlevel 1 ( +echo. pause - -:vscurrentinsiders -set msbuildpath=%ProgramFiles%\Microsoft Visual Studio\18\Insiders\MSBuild\Current\Bin -goto build2026 - -:vscurrentent -set msbuildpath=%ProgramFiles%\Microsoft Visual Studio\18\Enterprise\MSBuild\Current\Bin -goto build2026 - -:vscurrentpro -set msbuildpath=%ProgramFiles%\Microsoft Visual Studio\18\Professional\MSBuild\Current\Bin -goto build2026 - -:vscurrentcom -set msbuildpath=%ProgramFiles%\Microsoft Visual Studio\18\Community\MSBuild\Current\Bin -goto build2026 - -:vscurrentbuild -set msbuildpath=%ProgramFiles%\Microsoft Visual Studio\18\BuildTools\MSBuild\Current\Bin +goto exitbatch +) goto build2026 :build2026 -set targets=Build -if not "%~1" == "" set targets=%~1 -"%msbuildpath%\msbuild.exe" /t:%targets% build.proj /fl /flp:logfile=build.log - +@echo Started: %date% %time% +@echo +if "%targets%" == "" set "targets=Build" +if not "%~1" == "" set "targets=%~1" +REM /m: multi-processor MSBuild (all logical CPUs). +"%msbuildpath%\msbuild.exe" /m /t:%targets% "%SCRIPT_DIR%build.proj" /fl /flp:logfile="%SCRIPT_DIR%..\..\Logs\solution-build-log.log" /bl:"%SCRIPT_DIR%..\..\Logs\solution-build-log.binlog" /clp:Summary;ShowTimestamp /v:quiet +if "%afterpack%" == "1" goto packdone +goto postbuild + +:postbuild echo Do you now want to create NuGet packages? (y/n) set INPUT= -set /PINPUT=Type input: %=% +set /P "INPUT=Type input: " if /I "%INPUT%"=="y" goto createpackages if /I "%INPUT%"=="n" goto break +goto break :createpackages echo Do you want to pack using Visual Studio 2019 or 2026? (2019/2026) set INPUT= -set /P INPUT=Type 2019 or 2026: %=% -if /I "%INPUT%"=="2019" goto vs2019pack -if /I "%INPUT%"=="2026" goto vs2026pack - -:vs2019pack -build-2019.cmd Pack - +set /P "INPUT=Type 2019 or 2026: " +if /I "%INPUT%"=="2019" goto pack2019 +if /I "%INPUT%"=="2026" goto pack2026 +goto break + +:pack2019 +set "targets=Pack" +set "afterpack=1" +goto vs2019build + +:pack2026 +set "targets=Pack" +set "afterpack=1" +goto vs2026build + +:packdone @echo Build Completed: %date% %time% +goto break -:vs2026pack -build-2026.cmd Pack - -@echo Build Completed: %date% %time% :break pause @echo Build Completed: %date% %time% -:exitbatch \ No newline at end of file +:exitbatch +popd +exit /b \ No newline at end of file diff --git a/Scripts/Build/debug.cmd b/Scripts/Build/debug.cmd index 0e7f0b8a7b..1c0c4dd8ea 100644 --- a/Scripts/Build/debug.cmd +++ b/Scripts/Build/debug.cmd @@ -1,42 +1,25 @@ @echo off - -if exist "%ProgramFiles(x86)%\Microsoft Visual Studio\2019\Insiders\MSBuild\Current\Bin" goto vs16prev -if exist "%ProgramFiles(x86)%\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin" goto vs16ent -if exist "%ProgramFiles(x86)%\Microsoft Visual Studio\2019\Professional\MSBuild\Current\Bin" goto vs16pro -if exist "%ProgramFiles(x86)%\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin" goto vs16com -if exist "%ProgramFiles(x86)%\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin" goto vs16build - -echo "Unable to detect suitable environment. Check if VS 2019 is installed." - +REM Debug configuration build using the Scripts/Build/ toolset (Visual Studio 2019, profile "2019") +REM MSBuild discovery: Scripts\Common\find-msbuild.cmd. Failure text comes from the helper; this script only pauses. +setlocal EnableExtensions +set "SCRIPT_DIR=%~dp0" +pushd "%SCRIPT_DIR%" + +call "%SCRIPT_DIR%..\Common\find-msbuild.cmd" 2019 +if errorlevel 1 ( +echo. pause goto exitbatch - -:vs16prev -set msbuildpath=%ProgramFiles(x86)%\Microsoft Visual Studio\2019\Insiders\MSBuild\Current\Bin -goto build - -:vs16ent -set msbuildpath=%ProgramFiles(x86)%\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin -goto build - -:vs16pro -set msbuildpath=%ProgramFiles(x86)%\Microsoft Visual Studio\2019\Professional\MSBuild\Current\Bin -goto build - -:vs16com -set msbuildpath=%ProgramFiles(x86)%\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin -goto build - -:vs16build -set msbuildpath=%ProgramFiles(x86)%\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin +) goto build :build @echo Started: %date% %time% @echo -set targets=Build -if not "%~1" == "" set targets=%~1 -"%msbuildpath%\msbuild.exe" /t:%targets% build.proj /fl /flp:logfile=../Logs/debug-build-log.log /bl:../Logs/debug-build-log.binlog /clp:Summary;ShowTimestamp /v:quiet +set "targets=Build" +if not "%~1" == "" set "targets=%~1" +REM /m: multi-processor MSBuild (all logical CPUs). +"%msbuildpath%\msbuild.exe" /m /t:%targets% "%SCRIPT_DIR%debug.proj" /fl /flp:logfile="%SCRIPT_DIR%..\..\Logs\debug-build-log.log" /bl:"%SCRIPT_DIR%..\..\Logs\debug-build-log.binlog" /clp:Summary;ShowTimestamp /v:quiet @echo Build Completed: %date% %time% @echo @@ -44,4 +27,6 @@ echo Plese alter file '{Path}\Directory.Build.props' before executing 'publish.c pause -:exitbatch \ No newline at end of file +:exitbatch +popd +exit /b \ No newline at end of file diff --git a/Scripts/Build/rebuild-build-nightly.cmd b/Scripts/Build/rebuild-build-nightly.cmd index d723e42693..6cb93a77dd 100644 --- a/Scripts/Build/rebuild-build-nightly.cmd +++ b/Scripts/Build/rebuild-build-nightly.cmd @@ -1,34 +1,16 @@ @echo off - -if exist "%ProgramFiles%\Microsoft Visual Studio\18\Insiders\MSBuild\Current\Bin" goto vscurrentinsiders -if exist "%ProgramFiles%\Microsoft Visual Studio\18\Enterprise\MSBuild\Current\Bin" goto vscurrentent -if exist "%ProgramFiles%\Microsoft Visual Studio\18\Professional\MSBuild\Current\Bin" goto vscurrentpro -if exist "%ProgramFiles%\Microsoft Visual Studio\18\Community\MSBuild\Current\Bin" goto vscurrentcom -if exist "%ProgramFiles%\Microsoft Visual Studio\18\BuildTools\MSBuild\Current\Bin" goto vscurrentbuild - -echo "Unable to detect suitable environment. Check if VS 2026 is installed." - +REM Nightly rebuild using Visual Studio major 18+ (profile "current") from Scripts/Build/ +REM MSBuild discovery: Scripts\Common\find-msbuild.cmd. Failure text comes from the helper; this script only pauses. +setlocal EnableExtensions +set "SCRIPT_DIR=%~dp0" +pushd "%SCRIPT_DIR%" + +call "%SCRIPT_DIR%..\Common\find-msbuild.cmd" current +if errorlevel 1 ( +echo. pause goto exitbatch - -:vscurrentinsiders -set msbuildpath=%ProgramFiles%\Microsoft Visual Studio\18\Insiders\MSBuild\Current\Bin -goto build - -:vscurrentent -set msbuildpath=%ProgramFiles%\Microsoft Visual Studio\18\Enterprise\MSBuild\Current\Bin -goto build - -:vscurrentpro -set msbuildpath=%ProgramFiles%\Microsoft Visual Studio\18\Professional\MSBuild\Current\Bin -goto build - -:vscurrentcom -set msbuildpath=%ProgramFiles%\Microsoft Visual Studio\18\Community\MSBuild\Current\Bin -goto build - -:vscurrentbuild -set msbuildpath=%ProgramFiles%\Microsoft Visual Studio\18\BuildTools\MSBuild\Current\Bin +) goto build :build @@ -38,9 +20,9 @@ for /f "tokens=* usebackq" %%A in (`tzutil /g`) do ( @echo Rebuild Started: %date% %time% %zone% @echo -set targets=Rebuild -if not "%~1" == "" set targets=%~1 -"%msbuildpath%\msbuild.exe" -t:%targets% nightly.proj /fl /flp:logfile=../Logs/nightly-build-log.log /bl:../Logs/nightly-build-log.binlog /clp:Summary;ShowTimestamp /v:quiet +set "targets=Rebuild" +if not "%~1" == "" set "targets=%~1" +"%msbuildpath%\msbuild.exe" /m -t:%targets% "%SCRIPT_DIR%nightly.proj" /fl /flp:logfile="%SCRIPT_DIR%..\..\Logs\nightly-build-log.log" /bl:"%SCRIPT_DIR%..\..\Logs\nightly-build-log.binlog" /clp:Summary;ShowTimestamp /v:quiet :: -t:rebuild @@ -58,8 +40,11 @@ if %answer%==n exit @echo Invalid input, please try again. :run -cd ../.. +popd -run.cmd +"%SCRIPT_DIR%..\..\run.cmd" +exit /b -:exitbatch \ No newline at end of file +:exitbatch +popd +exit /b \ No newline at end of file diff --git a/Scripts/Common/find-msbuild.cmd b/Scripts/Common/find-msbuild.cmd new file mode 100644 index 0000000000..34d7ede18f --- /dev/null +++ b/Scripts/Common/find-msbuild.cmd @@ -0,0 +1,197 @@ +@echo off +REM ============================================================================= +REM find-msbuild.cmd - Locate MSBuild for a Visual Studio toolset generation +REM ============================================================================= +REM +REM PURPOSE +REM Shared helper for orchestration scripts under Scripts\Build\, +REM Scripts\VS2022\, and Scripts\Current\. Sets the caller's msbuildpath variable +REM to the directory containing MSBuild.exe. +REM +REM USAGE (must be CALLed) +REM call "%~dp0find-msbuild.cmd" +REM +REM PROFILES +REM 2019 Visual Studio 2019 (Scripts\Build\ legacy toolset) +REM 2022 Visual Studio 2022 (Scripts\VS2022\) +REM current Newest install with MSBuild, major version 18 or later +REM latest Alias for current +REM NN Pinned major folder (18, 19, 20, ...) for one yearly release +REM +REM DISCOVERY ORDER +REM 1. MSBUILDPATH or MSBUILD_PATH (MSBuild\Current\Bin directory) +REM 2. vswhere.exe (%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\) +REM 3. Standard folders under %ProgramFiles% / %ProgramFiles(x86)% +REM +REM Related issue: https://github.com/Krypton-Suite/Standard-Toolkit/issues/3788 +REM ============================================================================= + +setlocal EnableExtensions EnableDelayedExpansion + +set "VS_PROFILE=%~1" +if not defined VS_PROFILE goto :report_failure +if /I "!VS_PROFILE!"=="latest" set "VS_PROFILE=current" + +if defined MSBUILDPATH ( + if exist "!MSBUILDPATH!\MSBuild.exe" ( + set "FOUND_MSBUILD_BIN=!MSBUILDPATH!" + set "FOUND_VIA=override" + goto :report_success + ) +) +if defined MSBUILD_PATH ( + if exist "!MSBUILD_PATH!\MSBuild.exe" ( + set "FOUND_MSBUILD_BIN=!MSBUILD_PATH!" + set "FOUND_VIA=override" + goto :report_success + ) +) + +set "VS_VERSION_ARG=" +set "FALLBACK_MODE=" +set "VS_PRODUCT_LABEL=" +set "VS_MAJOR_FOLDER=" + +if /I "!VS_PROFILE!"=="2019" ( + set "VS_VERSION_ARG=-version [16.0,17.0)" + set "FALLBACK_MODE=2019" + set "VS_PRODUCT_LABEL=Visual Studio 2019" +) +if /I "!VS_PROFILE!"=="2022" ( + set "VS_VERSION_ARG=-version [17.0,18.0)" + set "FALLBACK_MODE=2022" + set "VS_PRODUCT_LABEL=Visual Studio 2022" +) +if /I "!VS_PROFILE!"=="current" ( + set "VS_VERSION_ARG=-version [18.0,) -latest" + set "FALLBACK_MODE=current" + set "VS_PRODUCT_LABEL=Visual Studio (current)" +) + +if not defined FALLBACK_MODE ( + echo !VS_PROFILE!| findstr /r "^[0-9][0-9]*$" >nul + if not errorlevel 1 ( + set "VS_MAJOR_FOLDER=!VS_PROFILE!" + set "FALLBACK_MODE=major" + set "VS_PRODUCT_LABEL=Visual Studio !VS_PROFILE!" + ) +) + +if not defined FALLBACK_MODE goto :report_failure + +if "!FALLBACK_MODE!"=="major" ( + set /a "VS_MAJOR_NEXT=!VS_MAJOR_FOLDER!+1" + set "VS_VERSION_ARG=-version [!VS_MAJOR_FOLDER!.0,!VS_MAJOR_NEXT!.0) -latest" +) + +set "VSWHERE=%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" +if exist "%VSWHERE%" if defined VS_VERSION_ARG ( + for /f "usebackq tokens=* delims=" %%M in (`"!VSWHERE!" !VS_VERSION_ARG! -products * -requires Microsoft.Component.MSBuild -find MSBuild\Current\Bin\MSBuild.exe 2^>nul`) do ( + set "FOUND_MSBUILD_BIN=%%~dpM" + set "FOUND_VIA=vswhere" + goto :report_success + ) +) + +if "!FALLBACK_MODE!"=="2019" goto :fallback_2019 +if "!FALLBACK_MODE!"=="2022" goto :fallback_2022 +if "!FALLBACK_MODE!"=="current" goto :fallback_current +if "!FALLBACK_MODE!"=="major" goto :fallback_major +goto :report_failure + +:fallback_2019 +set "VS_ROOT=%ProgramFiles(x86)%\Microsoft Visual Studio\2019" +for %%E in (Insiders Preview Enterprise Professional Community BuildTools) do ( + if exist "!VS_ROOT!\%%E\MSBuild\Current\Bin\MSBuild.exe" ( + set "FOUND_MSBUILD_BIN=!VS_ROOT!\%%E\MSBuild\Current\Bin" + set "FOUND_VIA=fallback" + goto :report_success + ) +) +goto :report_failure + +:fallback_2022 +set "VS_ROOT=%ProgramFiles%\Microsoft Visual Studio\2022" +for %%E in (Preview Enterprise Professional Community BuildTools) do ( + if exist "!VS_ROOT!\%%E\MSBuild\Current\Bin\MSBuild.exe" ( + set "FOUND_MSBUILD_BIN=!VS_ROOT!\%%E\MSBuild\Current\Bin" + set "FOUND_VIA=fallback" + goto :report_success + ) +) +goto :report_failure + +:fallback_current +for /L %%N in (99,-1,18) do ( + set "VS_ROOT=%ProgramFiles%\Microsoft Visual Studio\%%N" + for %%E in (Insiders Enterprise Professional Community BuildTools Preview) do ( + if exist "!VS_ROOT!\%%E\MSBuild\Current\Bin\MSBuild.exe" ( + set "FOUND_MSBUILD_BIN=!VS_ROOT!\%%E\MSBuild\Current\Bin" + set "FOUND_VIA=fallback" + goto :report_success + ) + ) +) +goto :report_failure + +:fallback_major +set "VS_ROOT=%ProgramFiles%\Microsoft Visual Studio\!VS_MAJOR_FOLDER!" +for %%E in (Insiders Enterprise Professional Community BuildTools Preview) do ( + if exist "!VS_ROOT!\%%E\MSBuild\Current\Bin\MSBuild.exe" ( + set "FOUND_MSBUILD_BIN=!VS_ROOT!\%%E\MSBuild\Current\Bin" + set "FOUND_VIA=fallback" + goto :report_success + ) +) +goto :report_failure + +:report_success +if "!FOUND_MSBUILD_BIN:~-1!"=="\" set "FOUND_MSBUILD_BIN=!FOUND_MSBUILD_BIN:~0,-1!" + +set "VS_EDITION=" +for %%E in (Insiders Preview Enterprise Professional Community BuildTools) do ( + if not "!FOUND_MSBUILD_BIN:\%%E\MSBuild=!"=="!FOUND_MSBUILD_BIN!" set "VS_EDITION=%%E" +) + +set "VS_DISPLAY_NAME=" +if /I "!FOUND_VIA!"=="vswhere" if exist "!VSWHERE!" if defined VS_VERSION_ARG ( + for /f "usebackq tokens=* delims=" %%D in (`"!VSWHERE!" !VS_VERSION_ARG! -products * -requires Microsoft.Component.MSBuild -property displayName 2^>nul`) do ( + if not defined VS_DISPLAY_NAME set "VS_DISPLAY_NAME=%%D" + ) +) + +set "MSBUILD_TOOL_VERSION=unknown" +for /f "usebackq tokens=* delims=" %%V in (`"!FOUND_MSBUILD_BIN!\MSBuild.exe" -version -nologo 2^>nul`) do set "MSBUILD_TOOL_VERSION=%%V" + +echo( +echo Using build tools: +if defined VS_DISPLAY_NAME ( + echo Visual Studio: !VS_DISPLAY_NAME! +) else if defined VS_EDITION ( + echo Visual Studio: !VS_PRODUCT_LABEL! !VS_EDITION! +) else ( + echo Visual Studio: !VS_PRODUCT_LABEL! +) +echo MSBuild path: !FOUND_MSBUILD_BIN! +echo MSBuild version: !MSBUILD_TOOL_VERSION! +echo( + +for %%P in ("!FOUND_MSBUILD_BIN!") do endlocal & set "msbuildpath=%%~P" & exit /b 0 + +:report_failure +echo( +echo Unable to detect suitable environment. +if /I "!VS_PROFILE!"=="2019" ( + echo Check if Visual Studio 2019 with MSBuild is installed, or set MSBUILDPATH / MSBUILD_PATH. +) else if /I "!VS_PROFILE!"=="2022" ( + echo Check if Visual Studio 2022 with MSBuild is installed, or set MSBUILDPATH / MSBUILD_PATH. +) else if /I "!VS_PROFILE!"=="current" ( + echo Check if Visual Studio 2026 or later with MSBuild is installed, or set MSBUILDPATH / MSBUILD_PATH. +) else if defined VS_MAJOR_FOLDER ( + set /a "VS_FAIL_YEAR=2008+!VS_MAJOR_FOLDER!" + echo Check if Visual Studio !VS_FAIL_YEAR! ^(major !VS_MAJOR_FOLDER!^) with MSBuild is installed, or set MSBUILDPATH / MSBUILD_PATH. +) else ( + echo Check that a supported Visual Studio install with MSBuild is available, or set MSBUILDPATH / MSBUILD_PATH. +) +echo( +exit /b 1 diff --git a/Scripts/Current/build-canary.cmd b/Scripts/Current/build-canary.cmd index 57f8eea50d..db1f4c4c97 100644 --- a/Scripts/Current/build-canary.cmd +++ b/Scripts/Current/build-canary.cmd @@ -1,37 +1,16 @@ @echo off +REM Canary release build using the Scripts/Current/ toolset (Visual Studio major 18+, profile "current") +REM MSBuild discovery: Scripts\Common\find-msbuild.cmd. Failure text comes from the helper; this script only pauses. setlocal EnableExtensions set "SCRIPT_DIR=%~dp0" pushd "%SCRIPT_DIR%" -if exist "%ProgramFiles%\Microsoft Visual Studio\18\Insiders\MSBuild\Current\Bin" goto vscurrentinsiders -if exist "%ProgramFiles%\Microsoft Visual Studio\18\Enterprise\MSBuild\Current\Bin" goto vscurrentent -if exist "%ProgramFiles%\Microsoft Visual Studio\18\Professional\MSBuild\Current\Bin" goto vscurrentpro -if exist "%ProgramFiles%\Microsoft Visual Studio\18\Community\MSBuild\Current\Bin" goto vscurrentcom -if exist "%ProgramFiles%\Microsoft Visual Studio\18\BuildTools\MSBuild\Current\Bin" goto vscurrentbuild - -echo "Unable to detect suitable environment. Check if VS 2026 is installed." +call "%SCRIPT_DIR%..\Common\find-msbuild.cmd" current +if errorlevel 1 ( echo. pause goto exitbatch - -:vscurrentinsiders -set "msbuildpath=%ProgramFiles%\Microsoft Visual Studio\18\Insiders\MSBuild\Current\Bin" -goto build - -:vscurrentent -set "msbuildpath=%ProgramFiles%\Microsoft Visual Studio\18\Enterprise\MSBuild\Current\Bin" -goto build - -:vscurrentpro -set "msbuildpath=%ProgramFiles%\Microsoft Visual Studio\18\Professional\MSBuild\Current\Bin" -goto build - -:vscurrentcom -set "msbuildpath=%ProgramFiles%\Microsoft Visual Studio\18\Community\MSBuild\Current\Bin" -goto build - -:vscurrentbuild -set "msbuildpath=%ProgramFiles%\Microsoft Visual Studio\18\BuildTools\MSBuild\Current\Bin" +) goto build :build @@ -45,7 +24,8 @@ for /f "tokens=* usebackq" %%A in (`tzutil /g`) do ( @echo: set "targets=Build" if not "%~1" == "" set "targets=%~1" -"%msbuildpath%\msbuild.exe" /t:%targets% "%SCRIPT_DIR%canary.proj" /fl /flp:logfile="%SCRIPT_DIR%..\..\Logs\canary-build-log.log" /bl:"%SCRIPT_DIR%..\..\Logs\canary-build-log.binlog" /clp:Summary;ShowTimestamp /v:quiet +REM Phased Krypton.* build + /m (see Scripts\Build\Krypton.Orchestration.targets). +"%msbuildpath%\msbuild.exe" /m /t:%targets% "%SCRIPT_DIR%canary.proj" /fl /flp:logfile="%SCRIPT_DIR%..\..\Logs\canary-build-log.log" /bl:"%SCRIPT_DIR%..\..\Logs\canary-build-log.binlog" /clp:Summary;ShowTimestamp /v:quiet @echo: @echo Canary release build completed: %date% %time% %zone% @echo: diff --git a/Scripts/Current/build-installer.cmd b/Scripts/Current/build-installer.cmd index 68e491af31..87e73918de 100644 --- a/Scripts/Current/build-installer.cmd +++ b/Scripts/Current/build-installer.cmd @@ -1,37 +1,16 @@ @echo off +REM Installer package build using the Scripts/Current/ toolset (Visual Studio major 18+, profile "current") +REM MSBuild discovery: Scripts\Common\find-msbuild.cmd. Failure text comes from the helper; this script only pauses. setlocal EnableExtensions set "SCRIPT_DIR=%~dp0" pushd "%SCRIPT_DIR%" -if exist "%ProgramFiles%\Microsoft Visual Studio\18\Insiders\MSBuild\Current\Bin" goto vscurrentinsiders -if exist "%ProgramFiles%\Microsoft Visual Studio\18\Enterprise\MSBuild\Current\Bin" goto vscurrentent -if exist "%ProgramFiles%\Microsoft Visual Studio\18\Professional\MSBuild\Current\Bin" goto vscurrentpro -if exist "%ProgramFiles%\Microsoft Visual Studio\18\Community\MSBuild\Current\Bin" goto vscurrentcom -if exist "%ProgramFiles%\Microsoft Visual Studio\18\BuildTools\MSBuild\Current\Bin" goto vscurrentbuild - -echo "Unable to detect suitable environment. Check if VS 2026 is installed." +call "%SCRIPT_DIR%..\Common\find-msbuild.cmd" current +if errorlevel 1 ( echo. pause goto exitbatch - -:vscurrentinsiders -set "msbuildpath=%ProgramFiles%\Microsoft Visual Studio\18\Insiders\MSBuild\Current\Bin" -goto build - -:vscurrentent -set "msbuildpath=%ProgramFiles%\Microsoft Visual Studio\18\Enterprise\MSBuild\Current\Bin" -goto build - -:vscurrentpro -set "msbuildpath=%ProgramFiles%\Microsoft Visual Studio\18\Professional\MSBuild\Current\Bin" -goto build - -:vscurrentcom -set "msbuildpath=%ProgramFiles%\Microsoft Visual Studio\18\Community\MSBuild\Current\Bin" -goto build - -:vscurrentbuild -set "msbuildpath=%ProgramFiles%\Microsoft Visual Studio\18\BuildTools\MSBuild\Current\Bin" +) goto build :build @@ -43,7 +22,8 @@ for /f "tokens=* usebackq" %%A in (`tzutil /g`) do ( @echo set "targets=Build" if not "%~1" == "" set "targets=%~1" -"%msbuildpath%\msbuild.exe" /t:%targets% "%SCRIPT_DIR%..\Project Files\installer.proj" /fl /flp:logfile="%SCRIPT_DIR%..\..\Logs\installer-build-log.log" /bl:"%SCRIPT_DIR%..\..\Logs\installer-build-log.binlog" /clp:Summary;ShowTimestamp /v:quiet +REM /m: multi-processor MSBuild (all logical CPUs). +"%msbuildpath%\msbuild.exe" /m /t:%targets% "%SCRIPT_DIR%..\Project Files\installer.proj" /fl /flp:logfile="%SCRIPT_DIR%..\..\Logs\installer-build-log.log" /bl:"%SCRIPT_DIR%..\..\Logs\installer-build-log.binlog" /clp:Summary;ShowTimestamp /v:quiet @echo Build Completed: %date% %time% %zone% diff --git a/Scripts/Current/build-lts.cmd b/Scripts/Current/build-lts.cmd index 9179183a25..2347c8e34c 100644 --- a/Scripts/Current/build-lts.cmd +++ b/Scripts/Current/build-lts.cmd @@ -1,37 +1,16 @@ @echo off +REM Long-term stable build using the Scripts/Current/ toolset (Visual Studio major 18+, profile "current") +REM MSBuild discovery: Scripts\Common\find-msbuild.cmd. Failure text comes from the helper; this script only pauses. setlocal EnableExtensions set "SCRIPT_DIR=%~dp0" pushd "%SCRIPT_DIR%" -if exist "%ProgramFiles%\Microsoft Visual Studio\18\Insiders\MSBuild\Current\Bin" goto vscurrentinsiders -if exist "%ProgramFiles%\Microsoft Visual Studio\18\Enterprise\MSBuild\Current\Bin" goto vscurrentent -if exist "%ProgramFiles%\Microsoft Visual Studio\18\Professional\MSBuild\Current\Bin" goto vscurrentpro -if exist "%ProgramFiles%\Microsoft Visual Studio\18\Community\MSBuild\Current\Bin" goto vscurrentcom -if exist "%ProgramFiles%\Microsoft Visual Studio\18\BuildTools\MSBuild\Current\Bin" goto vscurrentbuild - -echo "Unable to detect suitable environment. Check if VS 2026 is installed." +call "%SCRIPT_DIR%..\Common\find-msbuild.cmd" current +if errorlevel 1 ( echo. pause goto exitbatch - -:vscurrentinsiders -set "msbuildpath=%ProgramFiles%\Microsoft Visual Studio\18\Insiders\MSBuild\Current\Bin" -goto build - -:vscurrentent -set "msbuildpath=%ProgramFiles%\Microsoft Visual Studio\18\Enterprise\MSBuild\Current\Bin" -goto build - -:vscurrentpro -set "msbuildpath=%ProgramFiles%\Microsoft Visual Studio\18\Professional\MSBuild\Current\Bin" -goto build - -:vscurrentcom -set "msbuildpath=%ProgramFiles%\Microsoft Visual Studio\18\Community\MSBuild\Current\Bin" -goto build - -:vscurrentbuild -set "msbuildpath=%ProgramFiles%\Microsoft Visual Studio\18\BuildTools\MSBuild\Current\Bin" +) goto build :build @@ -45,7 +24,8 @@ for /f "tokens=* usebackq" %%A in (`tzutil /g`) do ( @echo: set "targets=Build" if not "%~1" == "" set "targets=%~1" -"%msbuildpath%\msbuild.exe" /t:%targets% "%SCRIPT_DIR%longtermstable.proj" /fl /flp:logfile="%SCRIPT_DIR%..\..\Logs\long-term-stable-build-log.log" /bl:"%SCRIPT_DIR%..\..\Logs\long-term-stable-build-log.binlog" /clp:Summary;ShowTimestamp /v:quiet +REM Phased Krypton.* build + /m (see Scripts\Build\Krypton.Orchestration.targets). +"%msbuildpath%\msbuild.exe" /m /t:%targets% "%SCRIPT_DIR%longtermstable.proj" /fl /flp:logfile="%SCRIPT_DIR%..\..\Logs\long-term-stable-build-log.log" /bl:"%SCRIPT_DIR%..\..\Logs\long-term-stable-build-log.binlog" /clp:Summary;ShowTimestamp /v:quiet @echo: @echo Stable release build completed: %date% %time% %zone% @echo: diff --git a/Scripts/Current/build-nightly-custom.cmd b/Scripts/Current/build-nightly-custom.cmd index 44ce78f0d3..7c8c28f68b 100644 --- a/Scripts/Current/build-nightly-custom.cmd +++ b/Scripts/Current/build-nightly-custom.cmd @@ -1,37 +1,16 @@ @echo off +REM Nightly custom-target build using the Scripts/Current/ toolset (Visual Studio major 18+, profile "current") +REM MSBuild discovery: Scripts\Common\find-msbuild.cmd. Failure text comes from the helper; this script only pauses. setlocal EnableExtensions set "SCRIPT_DIR=%~dp0" pushd "%SCRIPT_DIR%" -if exist "%ProgramFiles%\Microsoft Visual Studio\18\Insiders\MSBuild\Current\Bin" goto vscurrentinsiders -if exist "%ProgramFiles%\Microsoft Visual Studio\18\Enterprise\MSBuild\Current\Bin" goto vscurrentent -if exist "%ProgramFiles%\Microsoft Visual Studio\18\Professional\MSBuild\Current\Bin" goto vscurrentpro -if exist "%ProgramFiles%\Microsoft Visual Studio\18\Community\MSBuild\Current\Bin" goto vscurrentcom -if exist "%ProgramFiles%\Microsoft Visual Studio\18\BuildTools\MSBuild\Current\Bin" goto vscurrentbuild - -echo "Unable to detect suitable environment. Check if VS 2026 is installed." +call "%SCRIPT_DIR%..\Common\find-msbuild.cmd" current +if errorlevel 1 ( echo. pause goto exitbatch - -:vscurrentinsiders -set "msbuildpath=%ProgramFiles%\Microsoft Visual Studio\18\Insiders\MSBuild\Current\Bin" -goto build - -:vscurrentent -set "msbuildpath=%ProgramFiles%\Microsoft Visual Studio\18\Enterprise\MSBuild\Current\Bin" -goto build - -:vscurrentpro -set "msbuildpath=%ProgramFiles%\Microsoft Visual Studio\18\Professional\MSBuild\Current\Bin" -goto build - -:vscurrentcom -set "msbuildpath=%ProgramFiles%\Microsoft Visual Studio\18\Community\MSBuild\Current\Bin" -goto build - -:vscurrentbuild -set "msbuildpath=%ProgramFiles%\Microsoft Visual Studio\18\BuildTools\MSBuild\Current\Bin" +) goto build :build @@ -43,7 +22,7 @@ for /f "tokens=* usebackq" %%A in (`tzutil /g`) do ( @echo set "targets=Build" if not "%~1" == "" set "targets=%~1" -"%msbuildpath%\msbuild.exe" /t:%targets% "%SCRIPT_DIR%nightly.proj" /fl /flp:logfile="%SCRIPT_DIR%..\..\build.log" +"%msbuildpath%\msbuild.exe" /m /t:%targets% "%SCRIPT_DIR%nightly.proj" /fl /flp:logfile="%SCRIPT_DIR%..\..\build.log" @echo Build Completed: %date% %time% %zone% diff --git a/Scripts/Current/build-nightly.cmd b/Scripts/Current/build-nightly.cmd index 28050d57e4..eab9b6596c 100644 --- a/Scripts/Current/build-nightly.cmd +++ b/Scripts/Current/build-nightly.cmd @@ -1,37 +1,16 @@ @echo off +REM Nightly release build using the Scripts/Current/ toolset (Visual Studio major 18+, profile "current") +REM MSBuild discovery: Scripts\Common\find-msbuild.cmd. Failure text comes from the helper; this script only pauses. setlocal EnableExtensions set "SCRIPT_DIR=%~dp0" pushd "%SCRIPT_DIR%" -if exist "%ProgramFiles%\Microsoft Visual Studio\18\Insiders\MSBuild\Current\Bin" goto vscurrentinsiders -if exist "%ProgramFiles%\Microsoft Visual Studio\18\Enterprise\MSBuild\Current\Bin" goto vscurrentent -if exist "%ProgramFiles%\Microsoft Visual Studio\18\Professional\MSBuild\Current\Bin" goto vscurrentpro -if exist "%ProgramFiles%\Microsoft Visual Studio\18\Community\MSBuild\Current\Bin" goto vscurrentcom -if exist "%ProgramFiles%\Microsoft Visual Studio\18\BuildTools\MSBuild\Current\Bin" goto vscurrentbuild - -echo "Unable to detect suitable environment. Check if VS 2026 is installed." - +call "%SCRIPT_DIR%..\Common\find-msbuild.cmd" current +if errorlevel 1 ( +echo. pause goto exitbatch - -:vscurrentinsiders -set "msbuildpath=%ProgramFiles%\Microsoft Visual Studio\18\Insiders\MSBuild\Current\Bin" -goto build - -:vscurrentent -set "msbuildpath=%ProgramFiles%\Microsoft Visual Studio\18\Enterprise\MSBuild\Current\Bin" -goto build - -:vscurrentpro -set "msbuildpath=%ProgramFiles%\Microsoft Visual Studio\18\Professional\MSBuild\Current\Bin" -goto build - -:vscurrentcom -set "msbuildpath=%ProgramFiles%\Microsoft Visual Studio\18\Community\MSBuild\Current\Bin" -goto build - -:vscurrentbuild -set "msbuildpath=%ProgramFiles%\Microsoft Visual Studio\18\BuildTools\MSBuild\Current\Bin" +) goto build :build @@ -39,13 +18,14 @@ for /f "tokens=* usebackq" %%A in (`tzutil /g`) do ( set "zone=%%A" ) +REM Phased Krypton.* build + /m (see Scripts\Build\Krypton.Orchestration.targets). @echo Started to build Nightly release @echo: @echo Started: %date% %time% %zone% @echo: set "targets=Build" if not "%~1" == "" set "targets=%~1" -"%msbuildpath%\msbuild.exe" -t:%targets% "%SCRIPT_DIR%nightly.proj" /fl /flp:logfile="%SCRIPT_DIR%..\..\Logs\nightly-build-log.log" /bl:"%SCRIPT_DIR%..\..\Logs\nightly-build-log.binlog" /clp:Summary;ShowTimestamp /v:quiet +"%msbuildpath%\msbuild.exe" /m -t:%targets% "%SCRIPT_DIR%nightly.proj" /fl /flp:logfile="%SCRIPT_DIR%..\..\Logs\nightly-build-log.log" /bl:"%SCRIPT_DIR%..\..\Logs\nightly-build-log.binlog" /clp:Summary;ShowTimestamp /v:quiet @echo: :: -t:rebuild diff --git a/Scripts/Current/build-stable.cmd b/Scripts/Current/build-stable.cmd index ec326062f7..d22f4e9c3b 100644 --- a/Scripts/Current/build-stable.cmd +++ b/Scripts/Current/build-stable.cmd @@ -1,37 +1,16 @@ @echo off +REM Stable release build using the Scripts/Current/ toolset (Visual Studio major 18+, profile "current") +REM MSBuild discovery: Scripts\Common\find-msbuild.cmd. Failure text comes from the helper; this script only pauses. setlocal EnableExtensions set "SCRIPT_DIR=%~dp0" pushd "%SCRIPT_DIR%" -if exist "%ProgramFiles%\Microsoft Visual Studio\18\Insiders\MSBuild\Current\Bin" goto vscurrentinsiders -if exist "%ProgramFiles%\Microsoft Visual Studio\18\Enterprise\MSBuild\Current\Bin" goto vscurrentent -if exist "%ProgramFiles%\Microsoft Visual Studio\18\Professional\MSBuild\Current\Bin" goto vscurrentpro -if exist "%ProgramFiles%\Microsoft Visual Studio\18\Community\MSBuild\Current\Bin" goto vscurrentcom -if exist "%ProgramFiles%\Microsoft Visual Studio\18\BuildTools\MSBuild\Current\Bin" goto vscurrentbuild - -echo "Unable to detect suitable environment. Check if VS 2026 is installed." +call "%SCRIPT_DIR%..\Common\find-msbuild.cmd" current +if errorlevel 1 ( echo. pause goto exitbatch - -:vscurrentinsiders -set "msbuildpath=%ProgramFiles%\Microsoft Visual Studio\18\Insiders\MSBuild\Current\Bin" -goto build - -:vscurrentent -set "msbuildpath=%ProgramFiles%\Microsoft Visual Studio\18\Enterprise\MSBuild\Current\Bin" -goto build - -:vscurrentpro -set "msbuildpath=%ProgramFiles%\Microsoft Visual Studio\18\Professional\MSBuild\Current\Bin" -goto build - -:vscurrentcom -set "msbuildpath=%ProgramFiles%\Microsoft Visual Studio\18\Community\MSBuild\Current\Bin" -goto build - -:vscurrentbuild -set "msbuildpath=%ProgramFiles%\Microsoft Visual Studio\18\BuildTools\MSBuild\Current\Bin" +) goto build :build @@ -45,7 +24,8 @@ for /f "tokens=* usebackq" %%A in (`tzutil /g`) do ( @echo: set "targets=Build" if not "%~1" == "" set "targets=%~1" -"%msbuildpath%\msbuild.exe" /t:%targets% "%SCRIPT_DIR%build.proj" /fl /flp:logfile="%SCRIPT_DIR%..\..\Logs\stable-build-log.log" /bl:"%SCRIPT_DIR%..\..\Logs\stable-build-log.binlog" /clp:Summary;ShowTimestamp /v:quiet +REM Phased Krypton.* build + /m (see Scripts\Build\Krypton.Orchestration.targets). +"%msbuildpath%\msbuild.exe" /m /t:%targets% "%SCRIPT_DIR%build.proj" /fl /flp:logfile="%SCRIPT_DIR%..\..\Logs\stable-build-log.log" /bl:"%SCRIPT_DIR%..\..\Logs\stable-build-log.binlog" /clp:Summary;ShowTimestamp /v:quiet @echo: @echo Stable release build completed: %date% %time% %zone% @echo: diff --git a/Scripts/Current/buildsolution.cmd b/Scripts/Current/buildsolution.cmd index 1cd6270e2e..94f4563047 100644 --- a/Scripts/Current/buildsolution.cmd +++ b/Scripts/Current/buildsolution.cmd @@ -1,112 +1,58 @@ echo off +setlocal EnableExtensions +set "SCRIPT_DIR=%~dp0" +pushd "%SCRIPT_DIR%" -echo Do you want to build using Visual Studio 2019 or 2026? (2019/2026) +echo Do you want to build using Visual Studio 2026? (2026) set INPUT= -set /P INPUT=Type 2019 or 2026: %=% -if /I "%INPUT%"=="2019" goto vs2019build +set /P "INPUT=Type 2026: " if /I "%INPUT%"=="2026" goto vs2026build - -:vs2019build -if exist "%ProgramFiles(x86)%\Microsoft Visual Studio\2019\Insiders\MSBuild\Current\Bin" goto vs16prev -if exist "%ProgramFiles(x86)%\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin" goto vs16ent -if exist "%ProgramFiles(x86)%\Microsoft Visual Studio\2019\Professional\MSBuild\Current\Bin" goto vs16pro -if exist "%ProgramFiles(x86)%\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin" goto vs16com -if exist "%ProgramFiles(x86)%\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin" goto vs16build - -echo "Unable to detect suitable environment. Check if VS 2019 is installed." - -pause - goto exitbatch -:vs16prev -set msbuildpath=%ProgramFiles(x86)%\Microsoft Visual Studio\2019\Insiders\MSBuild\Current\Bin -goto build2019 - -:vs16ent -set msbuildpath=%ProgramFiles(x86)%\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin -goto build2019 - -:vs16pro -set msbuildpath=%ProgramFiles(x86)%\Microsoft Visual Studio\2019\Professional\MSBuild\Current\Bin -goto build2019 - -:vs16com -set msbuildpath=%ProgramFiles(x86)%\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin -goto build2019 - -:vs16build -set msbuildpath=%ProgramFiles(x86)%\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin -goto build2019 - -:build2019 -@echo Started: %date% %time% -@echo -set targets=Build -if not "%~1" == "" set targets=%~1 -"%msbuildpath%\msbuild.exe" /t:%targets% build.proj /fl /flp:logfile=../Logs/solution-build-log.log /bl:solution-build-log.binlog /clp:Summary;ShowTimestamp /v:quiet - :vs2026build -if exist "%ProgramFiles%\Microsoft Visual Studio\18\Insiders\MSBuild\Current\Bin" goto vscurrentinsiders -if exist "%ProgramFiles%\Microsoft Visual Studio\18\Enterprise\MSBuild\Current\Bin" goto vscurrentent -if exist "%ProgramFiles%\Microsoft Visual Studio\18\Professional\MSBuild\Current\Bin" goto vscurrentpro -if exist "%ProgramFiles%\Microsoft Visual Studio\18\Community\MSBuild\Current\Bin" goto vscurrentcom -if exist "%ProgramFiles%\Microsoft Visual Studio\18\BuildTools\MSBuild\Current\Bin" goto vscurrentbuild - -echo "Unable to detect suitable environment. Check if VS 2026 is installed." -goto exitbatch +call "%SCRIPT_DIR%..\Common\find-msbuild.cmd" current +if errorlevel 1 ( +echo. pause - -:vscurrentinsiders -set msbuildpath=%ProgramFiles%\Microsoft Visual Studio\18\Insiders\MSBuild\Current\Bin -goto build2026 - -:vscurrentent -set msbuildpath=%ProgramFiles%\Microsoft Visual Studio\18\Enterprise\MSBuild\Current\Bin -goto build2026 - -:vscurrentpro -set msbuildpath=%ProgramFiles%\Microsoft Visual Studio\18\Professional\MSBuild\Current\Bin -goto build2026 - -:vscurrentcom -set msbuildpath=%ProgramFiles%\Microsoft Visual Studio\18\Community\MSBuild\Current\Bin -goto build2026 - -:vscurrentbuild -set msbuildpath=%ProgramFiles%\Microsoft Visual Studio\18\BuildTools\MSBuild\Current\Bin +goto exitbatch +) goto build2026 :build2026 -set targets=Build -if not "%~1" == "" set targets=%~1 -"%msbuildpath%\msbuild.exe" /t:%targets% build.proj /fl /flp:logfile=build.log +@echo Started: %date% %time% +@echo +set "targets=Build" +if not "%~1" == "" set "targets=%~1" +REM /m: multi-processor MSBuild (all logical CPUs). +"%msbuildpath%\msbuild.exe" /m /t:%targets% "%SCRIPT_DIR%build.proj" /fl /flp:logfile="%SCRIPT_DIR%..\..\Logs\solution-build-log.log" /bl:"%SCRIPT_DIR%..\..\Logs\solution-build-log.binlog" /clp:Summary;ShowTimestamp /v:quiet +goto postbuild +:postbuild echo Do you now want to create NuGet packages? (y/n) set INPUT= -set /PINPUT=Type input: %=% +set /P "INPUT=Type input: " if /I "%INPUT%"=="y" goto createpackages if /I "%INPUT%"=="n" goto break +goto break :createpackages -echo Do you want to pack using Visual Studio 2019 or 2026? (2019/2026) +echo Do you want to pack using Visual Studio 2026? (2026) set INPUT= -set /P INPUT=Type 2019 or 2026: %=% -if /I "%INPUT%"=="2019" goto vs2019pack +set /P "INPUT=Type 2026: " if /I "%INPUT%"=="2026" goto vs2026pack - -:vs2019pack -build-2019.cmd Pack - -@echo Build Completed: %date% %time% +goto break :vs2026pack -build-2026.cmd Pack +"%msbuildpath%\msbuild.exe" /m /t:Pack "%SCRIPT_DIR%build.proj" /fl /flp:logfile="%SCRIPT_DIR%..\..\Logs\solution-pack-log.log" /bl:"%SCRIPT_DIR%..\..\Logs\solution-pack-log.binlog" /clp:Summary;ShowTimestamp /v:quiet @echo Build Completed: %date% %time% +goto break + :break pause @echo Build Completed: %date% %time% -:exitbatch \ No newline at end of file +:exitbatch +popd +exit /b \ No newline at end of file diff --git a/Scripts/Current/debug.cmd b/Scripts/Current/debug.cmd index 0e7f0b8a7b..7df892b488 100644 --- a/Scripts/Current/debug.cmd +++ b/Scripts/Current/debug.cmd @@ -1,42 +1,25 @@ @echo off - -if exist "%ProgramFiles(x86)%\Microsoft Visual Studio\2019\Insiders\MSBuild\Current\Bin" goto vs16prev -if exist "%ProgramFiles(x86)%\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin" goto vs16ent -if exist "%ProgramFiles(x86)%\Microsoft Visual Studio\2019\Professional\MSBuild\Current\Bin" goto vs16pro -if exist "%ProgramFiles(x86)%\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin" goto vs16com -if exist "%ProgramFiles(x86)%\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin" goto vs16build - -echo "Unable to detect suitable environment. Check if VS 2019 is installed." - +REM Debug configuration build using the Scripts/Current/ toolset (Visual Studio major 18+, profile "current") +REM MSBuild discovery: Scripts\Common\find-msbuild.cmd. Failure text comes from the helper; this script only pauses. +setlocal EnableExtensions +set "SCRIPT_DIR=%~dp0" +pushd "%SCRIPT_DIR%" + +call "%SCRIPT_DIR%..\Common\find-msbuild.cmd" current +if errorlevel 1 ( +echo. pause goto exitbatch - -:vs16prev -set msbuildpath=%ProgramFiles(x86)%\Microsoft Visual Studio\2019\Insiders\MSBuild\Current\Bin -goto build - -:vs16ent -set msbuildpath=%ProgramFiles(x86)%\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin -goto build - -:vs16pro -set msbuildpath=%ProgramFiles(x86)%\Microsoft Visual Studio\2019\Professional\MSBuild\Current\Bin -goto build - -:vs16com -set msbuildpath=%ProgramFiles(x86)%\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin -goto build - -:vs16build -set msbuildpath=%ProgramFiles(x86)%\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin +) goto build :build @echo Started: %date% %time% @echo -set targets=Build -if not "%~1" == "" set targets=%~1 -"%msbuildpath%\msbuild.exe" /t:%targets% build.proj /fl /flp:logfile=../Logs/debug-build-log.log /bl:../Logs/debug-build-log.binlog /clp:Summary;ShowTimestamp /v:quiet +set "targets=Build" +if not "%~1" == "" set "targets=%~1" +REM /m: multi-processor MSBuild (all logical CPUs). +"%msbuildpath%\msbuild.exe" /m /t:%targets% "%SCRIPT_DIR%debug.proj" /fl /flp:logfile="%SCRIPT_DIR%..\..\Logs\debug-build-log.log" /bl:"%SCRIPT_DIR%..\..\Logs\debug-build-log.binlog" /clp:Summary;ShowTimestamp /v:quiet @echo Build Completed: %date% %time% @echo @@ -44,4 +27,6 @@ echo Plese alter file '{Path}\Directory.Build.props' before executing 'publish.c pause -:exitbatch \ No newline at end of file +:exitbatch +popd +exit /b \ No newline at end of file diff --git a/Scripts/Current/rebuild-build-nightly.cmd b/Scripts/Current/rebuild-build-nightly.cmd index d723e42693..12b3b62bba 100644 --- a/Scripts/Current/rebuild-build-nightly.cmd +++ b/Scripts/Current/rebuild-build-nightly.cmd @@ -1,34 +1,16 @@ @echo off - -if exist "%ProgramFiles%\Microsoft Visual Studio\18\Insiders\MSBuild\Current\Bin" goto vscurrentinsiders -if exist "%ProgramFiles%\Microsoft Visual Studio\18\Enterprise\MSBuild\Current\Bin" goto vscurrentent -if exist "%ProgramFiles%\Microsoft Visual Studio\18\Professional\MSBuild\Current\Bin" goto vscurrentpro -if exist "%ProgramFiles%\Microsoft Visual Studio\18\Community\MSBuild\Current\Bin" goto vscurrentcom -if exist "%ProgramFiles%\Microsoft Visual Studio\18\BuildTools\MSBuild\Current\Bin" goto vscurrentbuild - -echo "Unable to detect suitable environment. Check if VS 2026 is installed." - +REM Nightly rebuild using the Scripts/Current/ toolset (Visual Studio major 18+, profile "current") +REM MSBuild discovery: Scripts\Common\find-msbuild.cmd. Failure text comes from the helper; this script only pauses. +setlocal EnableExtensions +set "SCRIPT_DIR=%~dp0" +pushd "%SCRIPT_DIR%" + +call "%SCRIPT_DIR%..\Common\find-msbuild.cmd" current +if errorlevel 1 ( +echo. pause goto exitbatch - -:vscurrentinsiders -set msbuildpath=%ProgramFiles%\Microsoft Visual Studio\18\Insiders\MSBuild\Current\Bin -goto build - -:vscurrentent -set msbuildpath=%ProgramFiles%\Microsoft Visual Studio\18\Enterprise\MSBuild\Current\Bin -goto build - -:vscurrentpro -set msbuildpath=%ProgramFiles%\Microsoft Visual Studio\18\Professional\MSBuild\Current\Bin -goto build - -:vscurrentcom -set msbuildpath=%ProgramFiles%\Microsoft Visual Studio\18\Community\MSBuild\Current\Bin -goto build - -:vscurrentbuild -set msbuildpath=%ProgramFiles%\Microsoft Visual Studio\18\BuildTools\MSBuild\Current\Bin +) goto build :build @@ -38,9 +20,9 @@ for /f "tokens=* usebackq" %%A in (`tzutil /g`) do ( @echo Rebuild Started: %date% %time% %zone% @echo -set targets=Rebuild -if not "%~1" == "" set targets=%~1 -"%msbuildpath%\msbuild.exe" -t:%targets% nightly.proj /fl /flp:logfile=../Logs/nightly-build-log.log /bl:../Logs/nightly-build-log.binlog /clp:Summary;ShowTimestamp /v:quiet +set "targets=Rebuild" +if not "%~1" == "" set "targets=%~1" +"%msbuildpath%\msbuild.exe" /m -t:%targets% "%SCRIPT_DIR%nightly.proj" /fl /flp:logfile="%SCRIPT_DIR%..\..\Logs\nightly-build-log.log" /bl:"%SCRIPT_DIR%..\..\Logs\nightly-build-log.binlog" /clp:Summary;ShowTimestamp /v:quiet :: -t:rebuild @@ -58,8 +40,11 @@ if %answer%==n exit @echo Invalid input, please try again. :run -cd ../.. +popd -run.cmd +"%SCRIPT_DIR%..\..\run.cmd" +exit /b -:exitbatch \ No newline at end of file +:exitbatch +popd +exit /b \ No newline at end of file diff --git a/Scripts/ModernBuild/General/AppState.cs b/Scripts/ModernBuild/General/AppState.cs index 441df73bf8..74ddde7cb6 100644 --- a/Scripts/ModernBuild/General/AppState.cs +++ b/Scripts/ModernBuild/General/AppState.cs @@ -39,6 +39,16 @@ public sealed class AppState /// Gets or sets the path to the MSBuild executable. /// public string MsBuildPath { get; set; } = string.Empty; + + /// + /// Gets or sets the MSBuild tool version from MSBuild.exe -version. + /// + public string MsBuildToolVersion { get; set; } = string.Empty; + + /// + /// Gets or sets the resolved Visual Studio product description for the MSBuild install. + /// + public string VsProductDescription { get; set; } = string.Empty; /// /// Gets or sets the project file path for the build operation. @@ -93,6 +103,11 @@ public sealed class AppState /// Gets or sets the UTC start time of the current build operation. /// public DateTime? StartTimeUtc { get; set; } + + /// + /// Gets or sets the UTC end time of the most recently completed build operation. + /// + public DateTime? EndTimeUtc { get; set; } /// /// Gets or sets the count of errors encountered during the build. diff --git a/Scripts/ModernBuild/General/BuildLogic.cs b/Scripts/ModernBuild/General/BuildLogic.cs index 8b8801d6ce..6c5faa5c82 100644 --- a/Scripts/ModernBuild/General/BuildLogic.cs +++ b/Scripts/ModernBuild/General/BuildLogic.cs @@ -88,7 +88,6 @@ private static string GetProjFileForChannel(AppState state, ChannelType channel) ChannelType.Canary => "canary.proj", _ => "build.proj" }; - return ResolveProjectFile(state.RootPath, name, state.ScriptProfile, state.MsBuildPath); } @@ -103,14 +102,13 @@ private static string GetProjFileForChannel(AppState state, ChannelType channel) private static string ResolveProjectFile(string rootPath, string name, ScriptProfile scriptProfile, string msBuildPath) { IReadOnlyList folderOrder = GetScriptResolutionOrder(scriptProfile, msBuildPath); - var candidates = new List(folderOrder.Count + 2); + var candidates = new List(folderOrder.Count + 4); foreach (string folder in folderOrder) { candidates.Add(Path.Combine(rootPath, "Scripts", folder, name)); } - // Legacy locations kept for backward compatibility with older repo layouts. candidates.Add(Path.Combine(rootPath, "Scripts", name)); candidates.Add(Path.Combine(rootPath, "Scripts", "Project-Files", name)); @@ -145,12 +143,92 @@ private static IReadOnlyList GetScriptResolutionOrder(ScriptProfile scri /// /// Locates the MSBuild executable on the system. - /// First attempts to use vswhere.exe to find the latest Visual Studio installation, - /// then falls back to common installation paths for Visual Studio 2022. + /// Discovery order matches Scripts\Common\find-msbuild.cmd: + /// MSBUILDPATH / MSBUILD_PATH override, vswhere.exe, then standard install folders under Program Files. /// /// The full path to the MSBuild executable. /// Thrown when MSBuild.exe cannot be found. internal static string LocateMSBuildExecutable() + { + string? path = TryResolveMsBuildFromEnvironment() + ?? TryResolveMsBuildFromVswhere() + ?? TryResolveMsBuildFromProgramFilesFallback(); + + if (!string.IsNullOrWhiteSpace(path)) + { + return path; + } + + throw new InvalidOperationException( + "Could not find MSBuild.exe. Install Visual Studio 2026 or later with MSBuild, " + + "or set MSBUILDPATH / MSBUILD_PATH to the MSBuild\\Current\\Bin directory."); + } + + /// + /// Returns the MSBuild tool version reported by MSBuild.exe -version. + /// + /// Full path to MSBuild.exe. + /// The version string, or unknown when it cannot be read. + internal static string GetMSBuildToolVersion(string msBuildExecutablePath) + { + try + { + var psi = new ProcessStartInfo + { + FileName = msBuildExecutablePath, + Arguments = "-version -nologo", + UseShellExecute = false, + RedirectStandardOutput = true, + CreateNoWindow = true + }; + using var p = Process.Start(psi)!; + string? line = p.StandardOutput.ReadLine(); + p.WaitForExit(3000); + return string.IsNullOrWhiteSpace(line) ? "unknown" : line.Trim(); + } + catch + { + return "unknown"; + } + } + + /// + /// Describes the Visual Studio product associated with an MSBuild.exe path. + /// + /// Full path to MSBuild.exe. + /// A display name such as Visual Studio Enterprise 2026, or a path-derived label. + internal static string DescribeVisualStudioInstallation(string msBuildExecutablePath) + { + string? fromVswhere = TryGetVisualStudioDisplayName(msBuildExecutablePath); + if (!string.IsNullOrWhiteSpace(fromVswhere)) + { + return fromVswhere; + } + + return DescribeVisualStudioFromPath(msBuildExecutablePath); + } + + private static string? TryResolveMsBuildFromEnvironment() + { + foreach (string variable in new[] { "MSBUILDPATH", "MSBUILD_PATH" }) + { + string? dir = Environment.GetEnvironmentVariable(variable); + if (string.IsNullOrWhiteSpace(dir)) + { + continue; + } + + string exe = Path.Combine(dir.TrimEnd('\\', '/'), "MSBuild.exe"); + if (File.Exists(exe)) + { + return exe; + } + } + + return null; + } + + private static string? TryResolveMsBuildFromVswhere() { try { @@ -159,42 +237,175 @@ internal static string LocateMSBuildExecutable() "Microsoft Visual Studio", "Installer", "vswhere.exe"); - if (File.Exists(vswhere)) + if (!File.Exists(vswhere)) { - var psi = new ProcessStartInfo - { - FileName = vswhere, - Arguments = "-latest -products * -requires Microsoft.Component.MSBuild -find MSBuild\\Current\\Bin\\MSBuild.exe", - UseShellExecute = false, - RedirectStandardOutput = true, - CreateNoWindow = true - }; - using var p = Process.Start(psi)!; - string? path = p.StandardOutput.ReadLine(); - p.WaitForExit(3000); - if (!string.IsNullOrWhiteSpace(path) && File.Exists(path)) + return null; + } + + var psi = new ProcessStartInfo + { + FileName = vswhere, + Arguments = "-version [18.0,) -latest -products * -requires Microsoft.Component.MSBuild -find MSBuild\\Current\\Bin\\MSBuild.exe", + UseShellExecute = false, + RedirectStandardOutput = true, + CreateNoWindow = true + }; + using var p = Process.Start(psi)!; + string? path = p.StandardOutput.ReadLine(); + p.WaitForExit(3000); + if (!string.IsNullOrWhiteSpace(path) && File.Exists(path)) + { + return path; + } + } + catch { } + + return null; + } + + private static string? TryResolveMsBuildFromProgramFilesFallback() + { + string programFiles = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles); + string[] editions = { "Insiders", "Enterprise", "Professional", "Community", "BuildTools", "Preview" }; + + foreach (string edition in editions) + { + string candidate = Path.Combine(programFiles, "Microsoft Visual Studio", "2022", edition, "MSBuild", "Current", "Bin", "MSBuild.exe"); + if (File.Exists(candidate)) + { + return candidate; + } + } + + for (int major = 99; major >= 18; major--) + { + foreach (string edition in editions) + { + string candidate = Path.Combine(programFiles, "Microsoft Visual Studio", major.ToString(), edition, "MSBuild", "Current", "Bin", "MSBuild.exe"); + if (File.Exists(candidate)) { - return path!; + return candidate; } } } - catch {} - string[] candidates = new[] + return null; + } + + private static string? TryGetVisualStudioDisplayName(string msBuildExecutablePath) + { + try { - "C:\\Program Files\\Microsoft Visual Studio\\2022\\Enterprise\\MSBuild\\Current\\Bin\\MSBuild.exe", - "C:\\Program Files\\Microsoft Visual Studio\\2022\\Professional\\MSBuild\\Current\\Bin\\MSBuild.exe", - "C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\MSBuild\\Current\\Bin\\MSBuild.exe" - }; + string vswhere = Path.Combine( + Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86), + "Microsoft Visual Studio", + "Installer", + "vswhere.exe"); + if (!File.Exists(vswhere)) + { + return null; + } + + string normalized = Path.GetFullPath(msBuildExecutablePath); + var psi = new ProcessStartInfo + { + FileName = vswhere, + Arguments = "-products * -requires Microsoft.Component.MSBuild -property installationPath,displayName", + UseShellExecute = false, + RedirectStandardOutput = true, + CreateNoWindow = true + }; + using var p = Process.Start(psi)!; + string? installPath = null; + string? displayName = null; + while (true) + { + string? line = p.StandardOutput.ReadLine(); + if (line == null) + { + break; + } + + if (installPath == null) + { + installPath = line.Trim(); + continue; + } + + displayName = line.Trim(); + if (!string.IsNullOrEmpty(installPath) && + normalized.StartsWith(Path.GetFullPath(installPath), StringComparison.OrdinalIgnoreCase) && + !string.IsNullOrEmpty(displayName)) + { + p.WaitForExit(3000); + return displayName; + } + + installPath = null; + displayName = null; + } + + p.WaitForExit(3000); + } + catch { } - foreach (string c in candidates) + return null; + } + + private static string DescribeVisualStudioFromPath(string msBuildExecutablePath) + { + string[] parts = msBuildExecutablePath.Split(Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar); + for (int i = 0; i < parts.Length - 1; i++) { - if (File.Exists(c)) + if (!string.Equals(parts[i], "Microsoft Visual Studio", StringComparison.OrdinalIgnoreCase)) + { + continue; + } + + string folder = parts[i + 1]; + string? edition = i + 2 < parts.Length ? parts[i + 2] : null; + if (int.TryParse(folder, out int major) && major >= 18) + { + int year = major + 2008; + return string.IsNullOrEmpty(edition) + ? $"Visual Studio {year}" + : $"Visual Studio {edition} {year}"; + } + + if (!string.IsNullOrEmpty(edition)) { - return c; + return $"Visual Studio {edition} {folder}"; } + + return $"Visual Studio {folder}"; + } + + return "Visual Studio"; + } + + private static bool IsCurrentGenerationMsBuildPath(string msBuildPath) + { + if (string.IsNullOrWhiteSpace(msBuildPath)) + { + return false; + } + + const string marker = "\\Microsoft Visual Studio\\"; + int idx = msBuildPath.IndexOf(marker, StringComparison.OrdinalIgnoreCase); + if (idx < 0) + { + return false; + } + + string segment = msBuildPath.Substring(idx + marker.Length); + int slash = segment.IndexOf('\\'); + if (slash <= 0) + { + return false; } - throw new InvalidOperationException("Could not find MSBuild.exe. Please ensure Visual Studio 2022 is installed."); + + string folder = segment.Substring(0, slash); + return int.TryParse(folder, out int major) && major >= 18; } /// @@ -281,13 +492,13 @@ internal static ScriptProfile GetEffectiveScriptProfile(ScriptProfile profile, s { return ScriptProfile.VS2022; } - if (msBuildPath.IndexOf("\\Microsoft Visual Studio\\18\\", StringComparison.OrdinalIgnoreCase) >= 0) + + if (IsCurrentGenerationMsBuildPath(msBuildPath)) { return ScriptProfile.Current; } } - // Default auto preference to Current for forward-compatible setups. return ScriptProfile.Current; } @@ -366,6 +577,7 @@ internal static void StartBuild(AppState state) state.NuGetRunPushAfterMsBuild = false; state.NuGetRunZipAfterMsBuild = false; state.LastCompletedTarget = null; + state.EndTimeUtc = null; if (state.Action == BuildAction.NuGetTools) { StartNuGetTools(state); @@ -380,6 +592,7 @@ internal static void StartBuild(AppState state) state.SummaryReady = false; state.ErrorCount = 0; state.WarningCount = 0; + state.EndTimeUtc = null; var nugetTargets = new List(); switch (state.NuGetAction) @@ -493,6 +706,7 @@ internal static void StopBuild(AppState state) finally { state.IsRunning = false; + state.EndTimeUtc = DateTime.UtcNow; state.PendingTargets = null; } } @@ -677,6 +891,7 @@ private static void StartNextBuildStep(AppState state) if (state.PendingTargets == null || state.PendingTargets.Count == 0) { state.IsRunning = false; + state.EndTimeUtc = DateTime.UtcNow; return; } string nextTarget = state.PendingTargets.Dequeue(); @@ -696,6 +911,7 @@ private static void StartSingleMsBuild(AppState state, string target) { state.OnOutput?.Invoke($"Project file not found: {state.ProjectFile}"); state.IsRunning = false; + state.EndTimeUtc = DateTime.UtcNow; state.LastExitCode = 1; return; } @@ -787,6 +1003,7 @@ private static void StartSingleMsBuild(AppState state, string target) catch {} TryLoadSummary(state); state.IsRunning = false; + state.EndTimeUtc = DateTime.UtcNow; state.RequestRenderAll?.Invoke(); return; } @@ -826,6 +1043,7 @@ private static void StartSingleMsBuild(AppState state, string target) // Only load summary once at the end of the full chain TryLoadSummary(state); state.IsRunning = false; + state.EndTimeUtc = DateTime.UtcNow; state.RequestRenderAll?.Invoke(); } }; @@ -834,6 +1052,7 @@ private static void StartSingleMsBuild(AppState state, string target) { state.StartTimeUtc = DateTime.UtcNow; } + state.EndTimeUtc = null; state.IsRunning = true; state.Process.Start(); state.Process.BeginOutputReadLine(); @@ -896,6 +1115,7 @@ internal static Task StartCleanAsync(AppState state, Action? onCompleted = null) } state.IsRunning = true; state.StartTimeUtc = DateTime.UtcNow; + state.EndTimeUtc = null; state.Tail.Clear(); state.SummaryReady = false; state.ErrorCount = 0; @@ -928,6 +1148,7 @@ void DelDir(string rel) DelDir("Logs"); state.LastExitCode = 0; state.IsRunning = false; + state.EndTimeUtc = DateTime.UtcNow; state.SummaryLines = new[] { "Clean completed." }; state.SummaryReady = true; state.OnOutput?.Invoke("Clean complete."); @@ -993,12 +1214,14 @@ private static void StartNuGetTools(AppState state) { state.LastExitCode = state.Process?.ExitCode ?? -1; state.IsRunning = false; + state.EndTimeUtc = DateTime.UtcNow; state.SummaryLines = new[] { $"NuGet tools exited with code {state.LastExitCode}." }; state.SummaryReady = true; }; state.IsRunning = true; state.StartTimeUtc = DateTime.UtcNow; + state.EndTimeUtc = null; state.Process.Start(); state.Process.BeginOutputReadLine(); state.Process.BeginErrorReadLine(); @@ -1213,6 +1436,7 @@ private static void RunNextNuGetPush(AppState state) if (state.NuGetPushQueue == null || state.NuGetPushQueue.Count == 0) { state.IsRunning = false; + state.EndTimeUtc = DateTime.UtcNow; state.LastExitCode = 0; state.SummaryLines = new[] { "NuGet push completed." }; state.SummaryReady = true; @@ -1280,6 +1504,7 @@ private static void RunNextNuGetPush(AppState state) state.OnOutput?.Invoke($"[red]nuget.exe exited with code {code} for {Path.GetFileName(pkg)}[/]"); state.LastExitCode = code; state.IsRunning = false; + state.EndTimeUtc = DateTime.UtcNow; state.SummaryLines = new[] { $"NuGet push failed for {Path.GetFileName(pkg)} (code {code})." }; state.SummaryReady = true; state.RequestRenderAll?.Invoke(); @@ -1291,6 +1516,7 @@ private static void RunNextNuGetPush(AppState state) { state.StartTimeUtc = DateTime.UtcNow; } + state.EndTimeUtc = null; state.IsRunning = true; state.Process.Start(); state.Process.BeginOutputReadLine(); diff --git a/Scripts/ModernBuild/General/BuildUI.cs b/Scripts/ModernBuild/General/BuildUI.cs index 0417e289b0..6d97e20614 100644 --- a/Scripts/ModernBuild/General/BuildUI.cs +++ b/Scripts/ModernBuild/General/BuildUI.cs @@ -814,18 +814,17 @@ private static BuildAction NextOpsAction(AppState state) } /// - /// Returns whether the selected channel supports a dedicated Rebuild target in its .proj file. + /// Returns whether the selected channel supports a dedicated Rebuild target. /// /// The selected build channel. - /// True when Rebuild is defined for the channel; otherwise false. + /// True for Nightly; otherwise false. private static bool SupportsRebuildForChannel(ChannelType channel) { return channel == ChannelType.Nightly; } /// - /// Normalizes Ops action selections when channel capabilities change. - /// Ensures combinations like Canary/Stable + Rebuild are not kept selected. + /// Normalizes the Ops action when switching away from a channel that supports Rebuild. /// /// The current application state. private static void NormalizeOpsActionForChannel(AppState state) @@ -968,7 +967,19 @@ private static void RenderStatus(AppState state, UIContext ui) { st = "FAILED"; } - TimeSpan? elapsed = state.IsRunning && state.StartTimeUtc.HasValue ? DateTime.UtcNow - state.StartTimeUtc.Value : (TimeSpan?)null; + TimeSpan? elapsed = null; + if (state.StartTimeUtc.HasValue) + { + DateTime? endTimeUtc = state.IsRunning ? DateTime.UtcNow : state.EndTimeUtc; + if (endTimeUtc.HasValue) + { + elapsed = endTimeUtc.Value - state.StartTimeUtc.Value; + if (elapsed.Value < TimeSpan.Zero) + { + elapsed = TimeSpan.Zero; + } + } + } string elapsedText = elapsed.HasValue ? elapsed.Value.ToString("hh\\:mm\\:ss") : "--:--:--"; if (ui.SummaryFrame != null) { @@ -1073,8 +1084,8 @@ string FormatAction(BuildAction a) if (ui.Hint != null) { ui.Hint.Text = showF9 - ? "F-keys cycle options.\nF9 cycles PackMode. F5 toggles Run/Stop." - : "F-keys cycle options.\nF9 cycles Scripts profile. F5 toggles Run/Stop."; + ? "F-keys cycle options.\nF9 cycles PackMode.\nF5 toggles Run/Stop." + : "F-keys cycle options.\nF9 cycles Scripts profile.\nF5 toggles Run/Stop."; } } else @@ -1217,7 +1228,9 @@ string TrimLogsPath(string fullPath) AddKV("Project", TrimScriptsPath(state.ProjectFile)); AddKV("Scripts", FormatScriptProfile(state)); + AddKV("Visual Studio", state.VsProductDescription); AddKV("MSBuild", state.MsBuildPath); + AddKV("MSBuild version", state.MsBuildToolVersion); AddKV("Text Log", TrimLogsPath(Path.Combine(state.RootPath, "Logs", prefix + "-build-summary.log"))); AddKV("BinLog", TrimLogsPath(Path.Combine(state.RootPath, "Logs", prefix + "-build.binlog"))); diff --git a/Scripts/ModernBuild/Program.cs b/Scripts/ModernBuild/Program.cs index 00e6e79c25..732a3a20af 100644 --- a/Scripts/ModernBuild/Program.cs +++ b/Scripts/ModernBuild/Program.cs @@ -26,6 +26,9 @@ private static int Main(string[] args) // Initialize the Terminal.Gui framework Application.Init(); + // Resolve MSBuild once at startup (vswhere, override env vars, then Program Files fallback). + string msBuildPath = BuildLogic.LocateMSBuildExecutable(); + // Create and initialize the application state with default values var state = new AppState { @@ -38,7 +41,9 @@ private static int Main(string[] args) // Discover the repository root directory RootPath = BuildLogic.FindRepoRoot(), // Locate the MSBuild executable on the system - MsBuildPath = BuildLogic.LocateMSBuildExecutable(), + MsBuildPath = msBuildPath, + MsBuildToolVersion = BuildLogic.GetMSBuildToolVersion(msBuildPath), + VsProductDescription = BuildLogic.DescribeVisualStudioInstallation(msBuildPath), // Set initial tail buffer size for output display TailLines = 200 }; diff --git a/Scripts/ModernBuild/README.md b/Scripts/ModernBuild/README.md index 1f3061e08d..d33be4bebc 100644 --- a/Scripts/ModernBuild/README.md +++ b/Scripts/ModernBuild/README.md @@ -1,182 +1,137 @@ -## ModernBuild - User Guide +## ModernBuild — User Guide ### What is ModernBuild? +ModernBuild is a Windows terminal UI (TUI) tool for building, packing, and publishing the Krypton Suite from the repository root using MSBuild and NuGet. It provides a simple keyboard-driven interface to: +- Build, rebuild, and pack channel-specific `.proj` files +- Create and optionally zip NuGet packages +- Push packages to NuGet.org or GitHub Packages -ModernBuild is a Windows terminal UI (TUI) tool for building, packing, and publishing Krypton Suite artifacts from the repository root using MSBuild and NuGet. - -It provides a keyboard-driven workflow to: - -- Build channel-specific `.proj` files -- Pack NuGet packages -- Push packages to NuGet feeds -- Preview push commands before execution - -ModernBuild uses `Terminal.Gui` and runs `MSBuild.exe` and `nuget.exe` under the hood. No CLI arguments are required. +It uses `Terminal.Gui` for the UI and drives `MSBuild.exe` and `nuget.exe` under the hood. No CLI arguments are required in this version. ### Requirements - - Windows 10/11 -- Visual Studio with MSBuild (VS2022 and newer supported) - - ModernBuild uses `vswhere.exe` to locate MSBuild and falls back to common VS2022 paths +- Visual Studio 2026 or later with the MSBuild component (Visual Studio 2022 is also detected via fallback probing) + - ModernBuild locates MSBuild via `MSBUILDPATH` / `MSBUILD_PATH`, then `vswhere.exe`, then standard folders under `%ProgramFiles%` (same order as `Scripts\Common\find-msbuild.cmd`). + - The Build Settings panel shows the resolved Visual Studio product, MSBuild path, and MSBuild version. - `nuget.exe` available on PATH for NuGet operations - - Example download: `https://dist.nuget.org/win-x86-commandline/latest/nuget.exe` + - Download from `https://dist.nuget.org/win-x86-commandline/latest/nuget.exe` and place it in a folder on PATH, or in the repo’s `Scripts/` folder. ### Repository layout ModernBuild expects - -ModernBuild supports the current scripts structure: - -- `Scripts/VS2022/` (VS 2022 toolset) -- `Scripts/Current/` (current/newer toolset, used for VS18/VS2026 style setup) -- `Scripts/Build/` (fallback scripts set) - -Legacy fallback locations are still probed: - -- `Scripts/` -- `Scripts/Project-Files/` - -Logs are written to `Logs/`. NuGet package discovery currently uses `Bin/Release/`. +- Project files are resolved from the selected scripts profile: + - `Scripts/VS2022/` + - `Scripts/Current/` + - `Scripts/Build/` + - legacy fallbacks: `Scripts/` and `Scripts/Project-Files/` +- Logs are written to `Logs/` +- Packages are produced into `Bin/Release/` ### Build and run - -Build: - +- Build (optional): ```powershell dotnet build Scripts/ModernBuild/ModernBuild.csproj -c Release ``` - -Run: - +- Run (recommended): ```powershell dotnet run --project Scripts/ModernBuild/ModernBuild.csproj ``` - -Or run a built executable, for example: - +- Or run the built executable (example path): ```powershell Scripts/ModernBuild/bin/Debug/net9.0-windows/ModernBuild.exe ``` -### UI layout +Tip: Run ModernBuild from the repository root so it can auto-detect the correct `.proj` paths. -- Tasks (top-left): hotkeys and current selections -- Build Settings (left): resolved project file, scripts profile, MSBuild path, logs -- Live Output (right): streaming MSBuild/NuGet output -- Summary (bottom): tail summary of the last run +### UI layout +- Tasks (top-left): hotkeys and current selections; switches between Ops and NuGet pages +- Build Settings (left): current project, MSBuild path, and log file locations +- Live Output (right): streaming MSBuild/NuGet output; press Enter on a line to copy it +- Summary (bottom): recent summary/log tail for quick diagnostics (paged) ### Global controls - -- `F4`: switch between Ops and NuGet pages -- `F5`: run/stop the current action -- `ESC` or `F10`: exit -- Auto-Scroll checkbox: follow live output - -### Scripts profile selection (`F9`) - -`F9` can switch script profiles: - -- `Auto -> VS2022 -> Current -> Auto` - -In Auto mode, ModernBuild chooses an effective profile from the detected MSBuild path: - -- MSBuild path containing `\Microsoft Visual Studio\2022\` -> `VS2022` -- MSBuild path containing `\Microsoft Visual Studio\18\` -> `Current` -- otherwise defaults to `Current` - -Special case: - -- On Ops page, when `Channel = Stable` and `Action = Pack` or `BuildPack`, `F9` cycles `PackMode` instead (`Pack -> PackLite -> PackAll`). +- F4: switch between Ops and NuGet pages +- F5: start/stop the current action +- F9: cycles scripts profile, except Stable Pack/BuildPack where it cycles PackMode +- ESC or F10: exit +- Auto-Scroll checkbox: toggles following live output ### Ops page (build workflow) - -- `F1` Channel: `Nightly -> Canary -> Stable` -- `F2` Action: - - Nightly: `Build -> Rebuild -> Pack -> BuildPack -> Debug -> Build` - - Canary/Stable: `Build -> Pack -> BuildPack -> Debug -> Build` -- `F3` Config: toggles `Release` / `Debug` -- `F6` Tail: cycles output buffer size `200 -> 500 -> 1000` -- `F7` Clean: deletes `Bin/`, selected component `obj/`, and `Logs/` -- `F8` Clear: clears live output view - -Action behavior: - -- `Build` runs MSBuild target `Build` -- `Rebuild` is available on Nightly and runs target `Rebuild` -- `Pack` runs channel pack target (`Pack`, or Stable `PackLite`/`PackAll` via PackMode) -- `BuildPack` runs clean-build target then pack: - - Nightly uses `Rebuild` then pack - - Canary/Stable uses `Build` then pack -- `Debug` triggers clean, switches to Nightly, then runs `Rebuild` +- F1 Channel: cycles Nightly → Canary → Stable + - When Nightly is selected, the configuration defaults to Debug + - For other channels, default configuration is the channel-appropriate one (e.g., Canary) or Release +- F2 Action: + - Nightly cycles Build → Rebuild → Pack → BuildPack → Debug + - Canary/Stable cycles Build → Pack → BuildPack → Debug + - Build runs `Build` + - Rebuild runs `Rebuild` for Nightly only + - Pack: runs channel-appropriate `Pack` + - BuildPack: runs `Rebuild` then `Pack` for Nightly, otherwise `Build` then `Pack` + - Debug: runs a clean, switches to Nightly, then executes `Rebuild` +- F3 Config: toggles Release/Debug (Nightly may auto-switch to Debug) +- F6 Tail: cycles live-output buffer size 200 → 500 → 1000 lines +- F7 Clean: deletes `Bin/`, component `obj/`, and `Logs/` +- F8 Clear: clears the live output and resets horizontal scroll +- F9 Scripts: cycles Auto → VS2022 → Current, except Stable Pack/BuildPack where it cycles Pack → PackLite → PackAll ### NuGet page (packaging and publishing) - -- Entering NuGet page forces configuration to `Release` -- `F1` Channel remains available -- `F2` NuGet Action cycle: - - `Rebuild+Pack` (Nightly) or `Build+Pack` (Canary/Stable) - - `Push` - - `Pack+Push` - - `Rebuild+Pack+Push` (Nightly) or `Build+Pack+Push` (Canary/Stable) - - `Update NuGet` -- `F5` Run/Stop: executes selected workflow -- `F6` Symbols: include `.snupkg` -- `F7` SkipDup: toggle `-SkipDuplicate` -- `F8` Source: `Default -> NuGet.org -> GitHub -> Custom` -- `F9` Scripts profile: cycles scripts profile on NuGet page -- `TEST`: preview push commands in Summary - -Source notes: - -- NuGet.org requires an API key: - - `nuget.exe setapikey -Source https://api.nuget.org/v3/index.json` -- GitHub source must exist in NuGet sources (for example name `github`) -- Custom source must be set in state; if empty, validation fails +- Configuration is set to Release when entering the NuGet page +- F1 Channel: still available (affects which `.proj` may be used for pack steps) +- F2 Action: cycles + - Rebuild+Pack: `Rebuild` then `Pack` for Nightly, otherwise `Build` then `Pack` + - Push: push existing packages only + - Pack+Push: `Pack` then push + - Rebuild+Pack+Push: `Rebuild`, `Pack`, then push for Nightly, otherwise `Build`, `Pack`, then push + - Update NuGet: runs `nuget.exe update -Self -NonInteractive` +- F3 Config: toggles Release/Debug (normally keep Release for publishing) +- F5 Run/Stop: executes the selected action(s) +- F6 Symbols: toggles inclusion of `.snupkg` symbol packages when pushing/previewing +- F7 SkipDup: toggles `-SkipDuplicate` for pushes +- F8 Source: cycles Default → NuGet.org → GitHub → Custom + - NuGet.org: requires an API key + - Set once: `nuget.exe setapikey -Source https://api.nuget.org/v3/index.json` + - GitHub: ensure a source named `github` exists (e.g., `nuget.exe sources add -Name github -Source https://nuget.pkg.github.com//index.json`) + - Custom: not configurable via UI in this version; if selected with no URL set, ModernBuild will emit an error +- Create ZIP: when visible, creates `Bin/_NuGet_Packages.zip` after packing +- TEST: previews the exact `nuget.exe push` commands in the Summary panel ### Outputs and logs - -- Text summary log: `Logs/-build-summary.log` +- Text summary: `Logs/-build-summary.log` - Binary log: `Logs/-build.binlog` +- Packages: `Bin/Release/*.nupkg` (and optionally `*.snupkg`) - Optional ZIP: `Bin/_NuGet_Packages.zip` -### How ModernBuild resolves project files - -File names by context: +### Status and navigation +- Status bar shows: RUNNING/DONE/FAILED, elapsed time, and running counts of errors/warnings +- Summary panel is paged: + - PageUp/PageDown/Home/End adjust the paging (when Summary is not focused) + - When focused, TextView handles its own navigation -- Nightly -> `nightly.proj` -- Canary -> `canary.proj` -- Stable -> `build.proj` -- Installer -> `installer.proj` +### How ModernBuild chooses the project file +- Nightly channel → `nightly.proj` +- Canary channel → `canary.proj` +- Stable channel → `build.proj` +- Installer (not exposed on Ops page) → `installer.proj` -Resolution order depends on effective scripts profile: +The Auto scripts profile chooses `VS2022` when MSBuild is detected under Visual Studio 2022, `Current` when MSBuild is detected under Visual Studio 18 (VS 2026), and otherwise defaults to `Current`. -- Effective `VS2022`: - - `Scripts/VS2022/` - - `Scripts/Current/` - - `Scripts/Build/` -- Effective `Current`: - - `Scripts/Current/` - - `Scripts/VS2022/` - - `Scripts/Build/` - -Legacy fallback (both modes): - -- `Scripts/` -- `Scripts/Project-Files/` +The effective profile controls the search order: +- VS2022: `Scripts/VS2022/`, then `Scripts/Current/`, then `Scripts/Build/` +- Current: `Scripts/Current/`, then `Scripts/VS2022/`, then `Scripts/Build/` +- Both profiles then fall back to `Scripts/` and `Scripts/Project-Files/` ### Troubleshooting - -- `Could not find MSBuild.exe` - - Ensure Visual Studio/MSBuild is installed -- `Project file not found: ...` - - Verify scripts folders and selected scripts profile -- `MSB4057 target ... does not exist` - - Usually means the chosen action is incompatible with that channel/project file - - Current versions prevent invalid Ops combos and map non-Nightly rebuild-like flows to `Build` +- "Could not find MSBuild.exe" + - Ensure Visual Studio 2022 is installed with MSBuild; rerun ModernBuild - `nuget.exe` not found - - Put `nuget.exe` on PATH -- No packages found for push - - Ensure expected packages exist under `Bin/Release/` + - Put `nuget.exe` on PATH or in the repo’s `Scripts/` folder +- "Project file not found: ..." + - Verify the channel project files exist in the selected scripts profile folder or fallback locations +- Build succeeds with no observable work + - ModernBuild will note this in output; verify your Configuration and the `.proj` target frameworks so targets aren’t skipped +- No packages found to push + - Ensure packages exist in `Bin/Release/` for the chosen channel/config +- Custom NuGet source + - Not settable via UI in this version; selecting Custom without a URL will cause validation to fail ### Notes - -- Stopping a run kills the entire spawned process tree -- No command-line options are currently exposed; interaction is through the TUI +- ModernBuild kills the entire MSBuild process tree when you stop a running action +- No CLI options are supported in this version; all interaction is via the UI diff --git a/Scripts/VS2022/build-canary.cmd b/Scripts/VS2022/build-canary.cmd index 11430dd26d..a678773598 100644 --- a/Scripts/VS2022/build-canary.cmd +++ b/Scripts/VS2022/build-canary.cmd @@ -1,37 +1,16 @@ @echo off +REM Canary release build using the Scripts/VS2022/ toolset (Visual Studio 2022, profile "2022") +REM MSBuild discovery: Scripts\Common\find-msbuild.cmd. Failure text comes from the helper; this script only pauses. setlocal EnableExtensions set "SCRIPT_DIR=%~dp0" pushd "%SCRIPT_DIR%" -if exist "%ProgramFiles%\Microsoft Visual Studio\2022\Preview\MSBuild\Current\Bin" goto vs17prev -if exist "%ProgramFiles%\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\Bin" goto vs17ent -if exist "%ProgramFiles%\Microsoft Visual Studio\2022\Professional\MSBuild\Current\Bin" goto vs17pro -if exist "%ProgramFiles%\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin" goto vs17com -if exist "%ProgramFiles%\Microsoft Visual Studio\2022\BuildTools\MSBuild\Current\Bin" goto vs17build - -echo "Unable to detect suitable environment. Check if VS 2022 is installed." +call "%SCRIPT_DIR%..\Common\find-msbuild.cmd" 2022 +if errorlevel 1 ( echo. pause goto exitbatch - -:vs17prev -set "msbuildpath=%ProgramFiles%\Microsoft Visual Studio\2022\Preview\MSBuild\Current\Bin" -goto build - -:vs17ent -set "msbuildpath=%ProgramFiles%\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\Bin" -goto build - -:vs17pro -set "msbuildpath=%ProgramFiles%\Microsoft Visual Studio\2022\Professional\MSBuild\Current\Bin" -goto build - -:vs17com -set "msbuildpath=%ProgramFiles%\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin" -goto build - -:vs17build -set "msbuildpath=%ProgramFiles%\Microsoft Visual Studio\2022\BuildTools\MSBuild\Current\Bin" +) goto build :build @@ -45,7 +24,8 @@ for /f "tokens=* usebackq" %%A in (`tzutil /g`) do ( @echo: set "targets=Build" if not "%~1" == "" set "targets=%~1" -"%msbuildpath%\msbuild.exe" /t:%targets% "%SCRIPT_DIR%canary.proj" /fl /flp:logfile="%SCRIPT_DIR%..\..\Logs\canary-build-log.log" /bl:"%SCRIPT_DIR%..\..\Logs\canary-build-log.binlog" /clp:Summary;ShowTimestamp /v:quiet +REM Phased Krypton.* build + /m (see Scripts\Build\Krypton.Orchestration.targets). +"%msbuildpath%\msbuild.exe" /m /t:%targets% "%SCRIPT_DIR%canary.proj" /fl /flp:logfile="%SCRIPT_DIR%..\..\Logs\canary-build-log.log" /bl:"%SCRIPT_DIR%..\..\Logs\canary-build-log.binlog" /clp:Summary;ShowTimestamp /v:quiet @echo: @echo Canary release build completed: %date% %time% %zone% @echo: diff --git a/Scripts/VS2022/build-installer.cmd b/Scripts/VS2022/build-installer.cmd index 00b03e4d25..512b925d3b 100644 --- a/Scripts/VS2022/build-installer.cmd +++ b/Scripts/VS2022/build-installer.cmd @@ -1,37 +1,16 @@ @echo off +REM Installer package build using the Scripts/VS2022/ toolset (Visual Studio 2022, profile "2022") +REM MSBuild discovery: Scripts\Common\find-msbuild.cmd. Failure text comes from the helper; this script only pauses. setlocal EnableExtensions set "SCRIPT_DIR=%~dp0" pushd "%SCRIPT_DIR%" -if exist "%ProgramFiles%\Microsoft Visual Studio\2022\Preview\MSBuild\Current\Bin" goto vs17prev -if exist "%ProgramFiles%\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\Bin" goto vs17ent -if exist "%ProgramFiles%\Microsoft Visual Studio\2022\Professional\MSBuild\Current\Bin" goto vs17pro -if exist "%ProgramFiles%\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin" goto vs17com -if exist "%ProgramFiles%\Microsoft Visual Studio\2022\BuildTools\MSBuild\Current\Bin" goto vs17build - -echo "Unable to detect suitable environment. Check if VS 2022 is installed." +call "%SCRIPT_DIR%..\Common\find-msbuild.cmd" 2022 +if errorlevel 1 ( echo. pause goto exitbatch - -:vs17prev -set "msbuildpath=%ProgramFiles%\Microsoft Visual Studio\2022\Preview\MSBuild\Current\Bin" -goto build - -:vs17ent -set "msbuildpath=%ProgramFiles%\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\Bin" -goto build - -:vs17pro -set "msbuildpath=%ProgramFiles%\Microsoft Visual Studio\2022\Professional\MSBuild\Current\Bin" -goto build - -:vs17com -set "msbuildpath=%ProgramFiles%\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin" -goto build - -:vs17build -set "msbuildpath=%ProgramFiles%\Microsoft Visual Studio\2022\BuildTools\MSBuild\Current\Bin" +) goto build :build @@ -43,7 +22,8 @@ for /f "tokens=* usebackq" %%A in (`tzutil /g`) do ( @echo set "targets=Build" if not "%~1" == "" set "targets=%~1" -"%msbuildpath%\msbuild.exe" /t:%targets% "%SCRIPT_DIR%..\Project Files\installer.proj" /fl /flp:logfile="%SCRIPT_DIR%..\..\Logs\installer-build-log.log" /bl:"%SCRIPT_DIR%..\..\Logs\installer-build-log.binlog" /clp:Summary;ShowTimestamp /v:quiet +REM /m: multi-processor MSBuild (all logical CPUs). +"%msbuildpath%\msbuild.exe" /m /t:%targets% "%SCRIPT_DIR%..\Project Files\installer.proj" /fl /flp:logfile="%SCRIPT_DIR%..\..\Logs\installer-build-log.log" /bl:"%SCRIPT_DIR%..\..\Logs\installer-build-log.binlog" /clp:Summary;ShowTimestamp /v:quiet @echo Build Completed: %date% %time% %zone% diff --git a/Scripts/VS2022/build-lts.cmd b/Scripts/VS2022/build-lts.cmd index 87d6d0f2d1..e7353b7be1 100644 --- a/Scripts/VS2022/build-lts.cmd +++ b/Scripts/VS2022/build-lts.cmd @@ -1,37 +1,16 @@ @echo off +REM Long-term stable build using the Scripts/VS2022/ toolset (Visual Studio 2022, profile "2022") +REM MSBuild discovery: Scripts\Common\find-msbuild.cmd. Failure text comes from the helper; this script only pauses. setlocal EnableExtensions set "SCRIPT_DIR=%~dp0" pushd "%SCRIPT_DIR%" -if exist "%ProgramFiles%\Microsoft Visual Studio\2022\Preview\MSBuild\Current\Bin" goto vs17prev -if exist "%ProgramFiles%\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\Bin" goto vs17ent -if exist "%ProgramFiles%\Microsoft Visual Studio\2022\Professional\MSBuild\Current\Bin" goto vs17pro -if exist "%ProgramFiles%\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin" goto vs17com -if exist "%ProgramFiles%\Microsoft Visual Studio\2022\BuildTools\MSBuild\Current\Bin" goto vs17build - -echo "Unable to detect suitable environment. Check if VS 2022 is installed." +call "%SCRIPT_DIR%..\Common\find-msbuild.cmd" 2022 +if errorlevel 1 ( echo. pause goto exitbatch - -:vs17prev -set "msbuildpath=%ProgramFiles%\Microsoft Visual Studio\2022\Preview\MSBuild\Current\Bin" -goto build - -:vs17ent -set "msbuildpath=%ProgramFiles%\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\Bin" -goto build - -:vs17pro -set "msbuildpath=%ProgramFiles%\Microsoft Visual Studio\2022\Professional\MSBuild\Current\Bin" -goto build - -:vs17com -set "msbuildpath=%ProgramFiles%\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin" -goto build - -:vs17build -set "msbuildpath=%ProgramFiles%\Microsoft Visual Studio\2022\BuildTools\MSBuild\Current\Bin" +) goto build :build @@ -45,7 +24,8 @@ for /f "tokens=* usebackq" %%A in (`tzutil /g`) do ( @echo: set "targets=Build" if not "%~1" == "" set "targets=%~1" -"%msbuildpath%\msbuild.exe" /t:%targets% "%SCRIPT_DIR%longtermstable.proj" /fl /flp:logfile="%SCRIPT_DIR%..\..\Logs\long-term-stable-build-log.log" /bl:"%SCRIPT_DIR%..\..\Logs\long-term-stable-build-log.binlog" /clp:Summary;ShowTimestamp /v:quiet +REM Phased Krypton.* build + /m (see Scripts\Build\Krypton.Orchestration.targets). +"%msbuildpath%\msbuild.exe" /m /t:%targets% "%SCRIPT_DIR%longtermstable.proj" /fl /flp:logfile="%SCRIPT_DIR%..\..\Logs\long-term-stable-build-log.log" /bl:"%SCRIPT_DIR%..\..\Logs\long-term-stable-build-log.binlog" /clp:Summary;ShowTimestamp /v:quiet @echo: @echo Stable release build completed: %date% %time% %zone% @echo: diff --git a/Scripts/VS2022/build-nightly-custom.cmd b/Scripts/VS2022/build-nightly-custom.cmd index 429c14dc80..3200092c06 100644 --- a/Scripts/VS2022/build-nightly-custom.cmd +++ b/Scripts/VS2022/build-nightly-custom.cmd @@ -1,37 +1,16 @@ @echo off +REM Nightly custom-target build using the Scripts/VS2022/ toolset (Visual Studio 2022, profile "2022") +REM MSBuild discovery: Scripts\Common\find-msbuild.cmd. Failure text comes from the helper; this script only pauses. setlocal EnableExtensions set "SCRIPT_DIR=%~dp0" pushd "%SCRIPT_DIR%" -if exist "%ProgramFiles%\Microsoft Visual Studio\2022\Preview\MSBuild\Current\Bin" goto vs17prev -if exist "%ProgramFiles%\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\Bin" goto vs17ent -if exist "%ProgramFiles%\Microsoft Visual Studio\2022\Professional\MSBuild\Current\Bin" goto vs17pro -if exist "%ProgramFiles%\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin" goto vs17com -if exist "%ProgramFiles%\Microsoft Visual Studio\2022\BuildTools\MSBuild\Current\Bin" goto vs17build - -echo "Unable to detect suitable environment. Check if VS 2022 is installed." +call "%SCRIPT_DIR%..\Common\find-msbuild.cmd" 2022 +if errorlevel 1 ( echo. pause goto exitbatch - -:vs17prev -set "msbuildpath=%ProgramFiles%\Microsoft Visual Studio\2022\Preview\MSBuild\Current\Bin" -goto build - -:vs17ent -set "msbuildpath=%ProgramFiles%\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\Bin" -goto build - -:vs17pro -set "msbuildpath=%ProgramFiles%\Microsoft Visual Studio\2022\Professional\MSBuild\Current\Bin" -goto build - -:vs17com -set "msbuildpath=%ProgramFiles%\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin" -goto build - -:vs17build -set "msbuildpath=%ProgramFiles%\Microsoft Visual Studio\2022\BuildTools\MSBuild\Current\Bin" +) goto build :build @@ -43,7 +22,7 @@ for /f "tokens=* usebackq" %%A in (`tzutil /g`) do ( @echo set "targets=Build" if not "%~1" == "" set "targets=%~1" -"%msbuildpath%\msbuild.exe" /t:%targets% "%SCRIPT_DIR%nightly.proj" /fl /flp:logfile="%SCRIPT_DIR%..\..\build.log" +"%msbuildpath%\msbuild.exe" /m /t:%targets% "%SCRIPT_DIR%nightly.proj" /fl /flp:logfile="%SCRIPT_DIR%..\..\build.log" @echo Build Completed: %date% %time% %zone% diff --git a/Scripts/VS2022/build-nightly.cmd b/Scripts/VS2022/build-nightly.cmd index 1c8cc12118..777c82e5b1 100644 --- a/Scripts/VS2022/build-nightly.cmd +++ b/Scripts/VS2022/build-nightly.cmd @@ -1,37 +1,16 @@ @echo off +REM Nightly release build using the Scripts/VS2022/ toolset (Visual Studio 2022, profile "2022") +REM MSBuild discovery: Scripts\Common\find-msbuild.cmd. Failure text comes from the helper; this script only pauses. setlocal EnableExtensions set "SCRIPT_DIR=%~dp0" pushd "%SCRIPT_DIR%" -if exist "%ProgramFiles%\Microsoft Visual Studio\2022\Preview\MSBuild\Current\Bin" goto vs17prev -if exist "%ProgramFiles%\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\Bin" goto vs17ent -if exist "%ProgramFiles%\Microsoft Visual Studio\2022\Professional\MSBuild\Current\Bin" goto vs17pro -if exist "%ProgramFiles%\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin" goto vs17com -if exist "%ProgramFiles%\Microsoft Visual Studio\2022\BuildTools\MSBuild\Current\Bin" goto vs17build - -echo "Unable to detect suitable environment. Check if VS 2022 is installed." - +call "%SCRIPT_DIR%..\Common\find-msbuild.cmd" 2022 +if errorlevel 1 ( +echo. pause goto exitbatch - -:vs17prev -set msbuildpath=%ProgramFiles%\Microsoft Visual Studio\2022\Preview\MSBuild\Current\Bin -goto build - -:vs17ent -set msbuildpath=%ProgramFiles%\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\Bin -goto build - -:vs17pro -set msbuildpath=%ProgramFiles%\Microsoft Visual Studio\2022\Professional\MSBuild\Current\Bin -goto build - -:vs17com -set msbuildpath=%ProgramFiles%\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin -goto build - -:vs17build -set msbuildpath=%ProgramFiles%\Microsoft Visual Studio\2022\BuildTools\MSBuild\Current\Bin +) goto build :build @@ -39,13 +18,14 @@ for /f "tokens=* usebackq" %%A in (`tzutil /g`) do ( set "zone=%%A" ) +REM Phased Krypton.* build + /m (see Scripts\Build\Krypton.Orchestration.targets). @echo Started to build Nightly release @echo: @echo Started: %date% %time% %zone% @echo: -set targets=Build -if not "%~1" == "" set targets=%~1 -"%msbuildpath%\msbuild.exe" -t:%targets% "%SCRIPT_DIR%nightly.proj" /fl /flp:logfile="%SCRIPT_DIR%..\..\Logs\nightly-build-log.log" /bl:"%SCRIPT_DIR%..\..\Logs\nightly-build-log.binlog" /clp:Summary;ShowTimestamp /v:quiet +set "targets=Build" +if not "%~1" == "" set "targets=%~1" +"%msbuildpath%\msbuild.exe" /m -t:%targets% "%SCRIPT_DIR%nightly.proj" /fl /flp:logfile="%SCRIPT_DIR%..\..\Logs\nightly-build-log.log" /bl:"%SCRIPT_DIR%..\..\Logs\nightly-build-log.binlog" /clp:Summary;ShowTimestamp /v:quiet @echo: :: -t:rebuild diff --git a/Scripts/VS2022/build-stable.cmd b/Scripts/VS2022/build-stable.cmd index cb653057fa..d51560149c 100644 --- a/Scripts/VS2022/build-stable.cmd +++ b/Scripts/VS2022/build-stable.cmd @@ -1,37 +1,16 @@ @echo off +REM Stable release build using the Scripts/VS2022/ toolset (Visual Studio 2022, profile "2022") +REM MSBuild discovery: Scripts\Common\find-msbuild.cmd. Failure text comes from the helper; this script only pauses. setlocal EnableExtensions set "SCRIPT_DIR=%~dp0" pushd "%SCRIPT_DIR%" -if exist "%ProgramFiles%\Microsoft Visual Studio\2022\Preview\MSBuild\Current\Bin" goto vs17prev -if exist "%ProgramFiles%\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\Bin" goto vs17ent -if exist "%ProgramFiles%\Microsoft Visual Studio\2022\Professional\MSBuild\Current\Bin" goto vs17pro -if exist "%ProgramFiles%\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin" goto vs17com -if exist "%ProgramFiles%\Microsoft Visual Studio\2022\BuildTools\MSBuild\Current\Bin" goto vs17build - -echo "Unable to detect suitable environment. Check if VS 2022 is installed." +call "%SCRIPT_DIR%..\Common\find-msbuild.cmd" 2022 +if errorlevel 1 ( echo. pause goto exitbatch - -:vs17prev -set "msbuildpath=%ProgramFiles%\Microsoft Visual Studio\2022\Preview\MSBuild\Current\Bin" -goto build - -:vs17ent -set "msbuildpath=%ProgramFiles%\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\Bin" -goto build - -:vs17pro -set "msbuildpath=%ProgramFiles%\Microsoft Visual Studio\2022\Professional\MSBuild\Current\Bin" -goto build - -:vs17com -set "msbuildpath=%ProgramFiles%\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin" -goto build - -:vs17build -set "msbuildpath=%ProgramFiles%\Microsoft Visual Studio\2022\BuildTools\MSBuild\Current\Bin" +) goto build :build @@ -45,7 +24,8 @@ for /f "tokens=* usebackq" %%A in (`tzutil /g`) do ( @echo: set "targets=Build" if not "%~1" == "" set "targets=%~1" -"%msbuildpath%\msbuild.exe" /t:%targets% "%SCRIPT_DIR%build.proj" /fl /flp:logfile="%SCRIPT_DIR%..\..\Logs\stable-build-log.log" /bl:"%SCRIPT_DIR%..\..\Logs\stable-build-log.binlog" /clp:Summary;ShowTimestamp /v:quiet +REM Phased Krypton.* build + /m (see Scripts\Build\Krypton.Orchestration.targets). +"%msbuildpath%\msbuild.exe" /m /t:%targets% "%SCRIPT_DIR%build.proj" /fl /flp:logfile="%SCRIPT_DIR%..\..\Logs\stable-build-log.log" /bl:"%SCRIPT_DIR%..\..\Logs\stable-build-log.binlog" /clp:Summary;ShowTimestamp /v:quiet @echo: @echo Stable release build completed: %date% %time% %zone% @echo: diff --git a/Scripts/VS2022/buildsolution.cmd b/Scripts/VS2022/buildsolution.cmd index 85150f7cbc..4a2cd2f1ea 100644 --- a/Scripts/VS2022/buildsolution.cmd +++ b/Scripts/VS2022/buildsolution.cmd @@ -1,112 +1,56 @@ echo off +setlocal EnableExtensions +set "SCRIPT_DIR=%~dp0" +pushd "%SCRIPT_DIR%" -echo Do you want to build using Visual Studio 2019 or 2022? (2019/2022) +echo Do you want to build using Visual Studio 2022? (2022) set INPUT= -set /P INPUT=Type 2019 or 2022: %=% -if /I "%INPUT%"=="2019" goto vs2019build +set /P "INPUT=Type 2022: " if /I "%INPUT%"=="2022" goto vs2022build - -:vs2019build -if exist "%ProgramFiles(x86)%\Microsoft Visual Studio\2019\Preview\MSBuild\Current\Bin" goto vs16prev -if exist "%ProgramFiles(x86)%\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin" goto vs16ent -if exist "%ProgramFiles(x86)%\Microsoft Visual Studio\2019\Professional\MSBuild\Current\Bin" goto vs16pro -if exist "%ProgramFiles(x86)%\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin" goto vs16com -if exist "%ProgramFiles(x86)%\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin" goto vs16build - -echo "Unable to detect suitable environment. Check if VS 2019 is installed." - -pause - goto exitbatch -:vs16prev -set msbuildpath=%ProgramFiles(x86)%\Microsoft Visual Studio\2019\Preview\MSBuild\Current\Bin -goto build2019 - -:vs16ent -set msbuildpath=%ProgramFiles(x86)%\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin -goto build2019 - -:vs16pro -set msbuildpath=%ProgramFiles(x86)%\Microsoft Visual Studio\2019\Professional\MSBuild\Current\Bin -goto build2019 - -:vs16com -set msbuildpath=%ProgramFiles(x86)%\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin -goto build2019 - -:vs16build -set msbuildpath=%ProgramFiles(x86)%\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin -goto build2019 - -:build2019 -@echo Started: %date% %time% -@echo -set targets=Build -if not "%~1" == "" set targets=%~1 -"%msbuildpath%\msbuild.exe" /t:%targets% build.proj /fl /flp:logfile=../Logs/solution-build-log.log /bl:solution-build-log.binlog /clp:Summary;ShowTimestamp /v:quiet - :vs2022build -if exist "%ProgramFiles%\Microsoft Visual Studio\2022\Preview\MSBuild\Current\Bin" goto vs17prev -if exist "%ProgramFiles%\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\Bin" goto vs17ent -if exist "%ProgramFiles%\Microsoft Visual Studio\2022\Professional\MSBuild\Current\Bin" goto vs17pro -if exist "%ProgramFiles%\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin" goto vs17com -if exist "%ProgramFiles%\Microsoft Visual Studio\2022\BuildTools\MSBuild\Current\Bin" goto vs17build - -echo "Unable to detect suitable environment. Check if VS 2022 is installed." -goto exitbatch +call "%SCRIPT_DIR%..\Common\find-msbuild.cmd" 2022 +if errorlevel 1 ( +echo. pause - -:vs17prev -set msbuildpath=%ProgramFiles%\Microsoft Visual Studio\2022\Preview\MSBuild\Current\Bin -goto build2022 - -:vs17ent -set msbuildpath=%ProgramFiles%\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\Bin -goto build2022 - -:vs17pro -set msbuildpath=%ProgramFiles%\Microsoft Visual Studio\2022\Professional\MSBuild\Current\Bin -goto build2022 - -:vs17com -set msbuildpath=%ProgramFiles%\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin -goto build2022 - -:vs17build -set msbuildpath=%ProgramFiles%\Microsoft Visual Studio\2022\BuildTools\MSBuild\Current\Bin +goto exitbatch +) goto build2022 :build2022 -set targets=Build -if not "%~1" == "" set targets=%~1 -"%msbuildpath%\msbuild.exe" /t:%targets% build.proj /fl /flp:logfile=build.log +@echo Started: %date% %time% +@echo +set "targets=Build" +if not "%~1" == "" set "targets=%~1" +REM /m: multi-processor MSBuild (all logical CPUs). +"%msbuildpath%\msbuild.exe" /m /t:%targets% "%SCRIPT_DIR%build.proj" /fl /flp:logfile="%SCRIPT_DIR%..\..\Logs\solution-build-log.log" /bl:"%SCRIPT_DIR%..\..\Logs\solution-build-log.binlog" /clp:Summary;ShowTimestamp /v:quiet +:postbuild echo Do you now want to create NuGet packages? (y/n) set INPUT= -set /PINPUT=Type input: %=% +set /P "INPUT=Type input: " if /I "%INPUT%"=="y" goto createpackages if /I "%INPUT%"=="n" goto break +goto break :createpackages -echo Do you want to pack using Visual Studio 2019 or 2022? (2019/2022) +echo Do you want to pack using Visual Studio 2022? (2022) set INPUT= -set /P INPUT=Type 2019 or 2022: %=% -if /I "%INPUT%"=="2019" goto vs2019pack +set /P "INPUT=Type 2022: " if /I "%INPUT%"=="2022" goto vs2022pack - -:vs2019pack -build-2019.cmd Pack - -@echo Build Completed: %date% %time% +goto break :vs2022pack -build-2022.cmd Pack +"%msbuildpath%\msbuild.exe" /m /t:Pack "%SCRIPT_DIR%build.proj" /fl /flp:logfile="%SCRIPT_DIR%..\..\Logs\solution-pack-log.log" /bl:"%SCRIPT_DIR%..\..\Logs\solution-pack-log.binlog" /clp:Summary;ShowTimestamp /v:quiet @echo Build Completed: %date% %time% +goto break :break pause @echo Build Completed: %date% %time% -:exitbatch \ No newline at end of file +:exitbatch +popd +exit /b \ No newline at end of file diff --git a/Scripts/VS2022/debug.cmd b/Scripts/VS2022/debug.cmd index d7b3995f55..931d60e54e 100644 --- a/Scripts/VS2022/debug.cmd +++ b/Scripts/VS2022/debug.cmd @@ -1,42 +1,25 @@ @echo off - -if exist "%ProgramFiles(x86)%\Microsoft Visual Studio\2019\Preview\MSBuild\Current\Bin" goto vs16prev -if exist "%ProgramFiles(x86)%\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin" goto vs16ent -if exist "%ProgramFiles(x86)%\Microsoft Visual Studio\2019\Professional\MSBuild\Current\Bin" goto vs16pro -if exist "%ProgramFiles(x86)%\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin" goto vs16com -if exist "%ProgramFiles(x86)%\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin" goto vs16build - -echo "Unable to detect suitable environment. Check if VS 2019 is installed." - +REM Debug configuration build using the Scripts/VS2022/ toolset (Visual Studio 2022, profile "2022") +REM MSBuild discovery: Scripts\Common\find-msbuild.cmd. Failure text comes from the helper; this script only pauses. +setlocal EnableExtensions +set "SCRIPT_DIR=%~dp0" +pushd "%SCRIPT_DIR%" + +call "%SCRIPT_DIR%..\Common\find-msbuild.cmd" 2022 +if errorlevel 1 ( +echo. pause goto exitbatch - -:vs16prev -set msbuildpath=%ProgramFiles(x86)%\Microsoft Visual Studio\2019\Preview\MSBuild\Current\Bin -goto build - -:vs16ent -set msbuildpath=%ProgramFiles(x86)%\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin -goto build - -:vs16pro -set msbuildpath=%ProgramFiles(x86)%\Microsoft Visual Studio\2019\Professional\MSBuild\Current\Bin -goto build - -:vs16com -set msbuildpath=%ProgramFiles(x86)%\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin -goto build - -:vs16build -set msbuildpath=%ProgramFiles(x86)%\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin +) goto build :build @echo Started: %date% %time% @echo -set targets=Build -if not "%~1" == "" set targets=%~1 -"%msbuildpath%\msbuild.exe" /t:%targets% build.proj /fl /flp:logfile=../Logs/debug-build-log.log /bl:../Logs/debug-build-log.binlog /clp:Summary;ShowTimestamp /v:quiet +set "targets=Build" +if not "%~1" == "" set "targets=%~1" +REM /m: multi-processor MSBuild (all logical CPUs). +"%msbuildpath%\msbuild.exe" /m /t:%targets% "%SCRIPT_DIR%debug.proj" /fl /flp:logfile="%SCRIPT_DIR%..\..\Logs\debug-build-log.log" /bl:"%SCRIPT_DIR%..\..\Logs\debug-build-log.binlog" /clp:Summary;ShowTimestamp /v:quiet @echo Build Completed: %date% %time% @echo @@ -44,4 +27,6 @@ echo Plese alter file '{Path}\Directory.Build.props' before executing 'publish.c pause -:exitbatch \ No newline at end of file +:exitbatch +popd +exit /b \ No newline at end of file diff --git a/Scripts/VS2022/rebuild-build-nightly.cmd b/Scripts/VS2022/rebuild-build-nightly.cmd index 57ed7787fe..3b8a71e33e 100644 --- a/Scripts/VS2022/rebuild-build-nightly.cmd +++ b/Scripts/VS2022/rebuild-build-nightly.cmd @@ -1,34 +1,16 @@ @echo off - -if exist "%ProgramFiles%\Microsoft Visual Studio\2022\Preview\MSBuild\Current\Bin" goto vs17prev -if exist "%ProgramFiles%\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\Bin" goto vs17ent -if exist "%ProgramFiles%\Microsoft Visual Studio\2022\Professional\MSBuild\Current\Bin" goto vs17pro -if exist "%ProgramFiles%\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin" goto vs17com -if exist "%ProgramFiles%\Microsoft Visual Studio\2022\BuildTools\MSBuild\Current\Bin" goto vs17build - -echo "Unable to detect suitable environment. Check if VS 2022 is installed." - +REM Nightly rebuild using the Scripts/VS2022/ toolset (Visual Studio 2022, profile "2022") +REM MSBuild discovery: Scripts\Common\find-msbuild.cmd. Failure text comes from the helper; this script only pauses. +setlocal EnableExtensions +set "SCRIPT_DIR=%~dp0" +pushd "%SCRIPT_DIR%" + +call "%SCRIPT_DIR%..\Common\find-msbuild.cmd" 2022 +if errorlevel 1 ( +echo. pause goto exitbatch - -:vs17prev -set msbuildpath=%ProgramFiles%\Microsoft Visual Studio\2022\Preview\MSBuild\Current\Bin -goto build - -:vs17ent -set msbuildpath=%ProgramFiles%\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\Bin -goto build - -:vs17pro -set msbuildpath=%ProgramFiles%\Microsoft Visual Studio\2022\Professional\MSBuild\Current\Bin -goto build - -:vs17com -set msbuildpath=%ProgramFiles%\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin -goto build - -:vs17build -set msbuildpath=%ProgramFiles%\Microsoft Visual Studio\2022\BuildTools\MSBuild\Current\Bin +) goto build :build @@ -38,9 +20,9 @@ for /f "tokens=* usebackq" %%A in (`tzutil /g`) do ( @echo Rebuild Started: %date% %time% %zone% @echo -set targets=Rebuild -if not "%~1" == "" set targets=%~1 -"%msbuildpath%\msbuild.exe" -t:%targets% nightly.proj /fl /flp:logfile=../Logs/nightly-build-log.log /bl:../Logs/nightly-build-log.binlog /clp:Summary;ShowTimestamp /v:quiet +set "targets=Rebuild" +if not "%~1" == "" set "targets=%~1" +"%msbuildpath%\msbuild.exe" /m -t:%targets% "%SCRIPT_DIR%nightly.proj" /fl /flp:logfile="%SCRIPT_DIR%..\..\Logs\nightly-build-log.log" /bl:"%SCRIPT_DIR%..\..\Logs\nightly-build-log.binlog" /clp:Summary;ShowTimestamp /v:quiet :: -t:rebuild @@ -58,8 +40,11 @@ if %answer%==n exit @echo Invalid input, please try again. :run -cd ../.. +popd -run.cmd +"%SCRIPT_DIR%..\..\run.cmd" +exit /b -:exitbatch \ No newline at end of file +:exitbatch +popd +exit /b \ No newline at end of file