From 86b1f7a364158c88d7546e90fcb9fea4f0876007 Mon Sep 17 00:00:00 2001 From: Daniel Jackson Date: Fri, 9 Feb 2024 16:46:23 +0000 Subject: [PATCH] Update build to use WiX v4 --- .gitignore | 2 + build-installer.cmd | 37 ++++++------------- toggle.wixproj | 12 ++++++ toggle.wxs | 90 +++++++++++++++++++++------------------------ 4 files changed, 67 insertions(+), 74 deletions(-) create mode 100644 toggle.wixproj diff --git a/.gitignore b/.gitignore index 706b104..bad4046 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,5 @@ _local /*.wixpdb /*.msi /build +/obj +/bin diff --git a/build-installer.cmd b/build-installer.cmd index 599bb86..cf62a2c 100644 --- a/build-installer.cmd +++ b/build-installer.cmd @@ -27,31 +27,17 @@ for /f "tokens=3 usebackq" %%f in (`type toggle.rc ^| findstr /R /C:"#define[ ]V for /f "tokens=3 usebackq" %%f in (`type toggle.rc ^| findstr /R /C:"#define[ ]VER_BUILD"`) do set VER=%VER%.%%f rem for /f "tokens=3 usebackq" %%f in (`type toggle.rc ^| findstr /R /C:"#define[ ]VER_REVISION"`) do set VER=%VER%.%%f -:PATH_CANDLE -SET WIX_PATH= -SET FIND_CANDLE= -FOR %%p IN (candle.exe) DO SET "FIND_CANDLE=%%~$PATH:p" -IF NOT DEFINED FIND_CANDLE GOTO LOCATE_CANDLE -SET WIX_PATH=%FIND_CANDLE:~0,-10% -ECHO WiX Toolset located on path: %WIX_PATH% -GOTO BUILD - -:LOCATE_CANDLE -ECHO Searching for WiX Toolset... -FOR /F "usebackq tokens=*" %%f IN (`DIR /B /ON "%ProgramFiles(x86)%\WiX Toolset*"`) DO IF EXIST "%ProgramFiles(x86)%\%%f\bin\candle.exe" SET "WIX_PATH=%ProgramFiles(x86)%\%%f\bin\" -IF "%WIX_PATH%"=="" ECHO Cannot find WiX Toolset & GOTO ERROR -ECHO WiX Toolset found at: %WIX_PATH% - -:BUILD -ECHO Building... -"%WIX_PATH%candle.exe" -ext WixUtilExtension toggle.wxs -IF ERRORLEVEL 1 GOTO ERROR - -ECHO Building... -"%WIX_PATH%light.exe" -sice:ICE91 -ext WixUtilExtension -ext WixUIExtension toggle.wixobj -IF ERRORLEVEL 1 GOTO ERROR - - +::: Using .wixproj for WiX V4 +dotnet build -c Release toggle.wixproj +IF ERRORLEVEL 1 ( + ECHO If WiX Toolset not installed: + ECHO dotnet tool install --global wix + REM ECHO dotnet add package WixToolset.UI.wixext + REM ECHO dotnet add package WixToolset.Util.wixext + ECHO. + GOTO ERROR +) +copy /Y bin\Release\toggle.msi toggle.msi :PATH_WINDOWSKIT SET WINDOWSKIT_PATH= @@ -91,6 +77,7 @@ rem IF ERRORLEVEL 1 GOTO ERROR "%WINDOWSKIT_PATH%signtool.exe" sign /debug /v /a /f "D:\Certificates\mycert.pfx" /d "Toggle Light/Dark" %TIMESTAMP_SERVER% "toggle.msi" IF ERRORLEVEL 1 GOTO ERROR +ECHO. ECHO Done: V%VER% IF DEFINED INTERACTIVE_IBUILD COLOR 2F & PAUSE & COLOR GOTO :EOF diff --git a/toggle.wixproj b/toggle.wixproj new file mode 100644 index 0000000..92ff773 --- /dev/null +++ b/toggle.wixproj @@ -0,0 +1,12 @@ + + + + + + + diff --git a/toggle.wxs b/toggle.wxs index b4f92e5..e08e408 100644 --- a/toggle.wxs +++ b/toggle.wxs @@ -1,73 +1,36 @@ - - - - - - + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - START_FROM_REGISTRY - - - + - 1 + - - Installed - - - - Installed - + - + - + - WIXUI_EXITDIALOGOPTIONALCHECKBOX = 1 and NOT Installed + - + @@ -90,5 +53,34 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +