oleg-shilo / wixsharp

Framework for building a complete MSI or WiX source code by using script files written with C# syntax.
MIT License
1.12k stars 176 forks source link

Generate only small Installer.exe file to binary #1170

Closed Zerpico closed 2 years ago

Zerpico commented 2 years ago

In the old version of WixSharp, it was possible to build only a small installer.exe, without the MSI file. And then call this file to generate the MSI. How to do the same with the latest versions?

oleg-shilo commented 2 years ago

It is still the same. Create the VS project from WixSharp template and you can F5 and it will do the MSI build for you.

Zerpico commented 2 years ago

It is still the same. Create the VS project from WixSharp template and you can F5 and it will do the MSI build for you.

I found what I need. I'm building a project with the project.BuildMsiCmd() method. This generates a BATCH file which I later run.

Although there was one problem. When bootstrap.BuildCmd() is executed, it generates a BATCH file, but the path in the file to the .wxs file is relative, that is, not the full path. Although when generating a msi batch file, it contains an absolute path

msi batch:

echo off
@setlocal
set WixLocation=C:\Program Files (x86)\WiX Toolset v3.11\bin
call "C:\Program Files (x86)\WiX Toolset v3.11\bin\candle.exe" -sw1026    -ext "C:\Program Files (x86)\WiX Toolset v3.11\bin\WiXNetFxExtension.dll"  -ext "C:\Program Files (x86)\WiX Toolset v3.11\bin\WixFirewallExtension.dll"  -ext "C:\Program Files (x86)\WiX Toolset v3.11\bin\WixUIExtension.dll" "D:\sources\analytics\NetVideo.Analytics.SetupServer\Domination Analytics Server.wxs"  -out "D:\sources\analytics\NetVideo.Analytics.SetupServer\Domination Analytics Server.wixobj"
if ERRORLEVEL 1 @echo candle.exe failed & GOTO ERROR
call "C:\Program Files (x86)\WiX Toolset v3.11\bin\light.exe" -sw1076 -sw1079   -b "D:\sources\analytics\NetVideo.Analytics.SetupServer" "D:\sources\analytics\NetVideo.Analytics.SetupServer\Domination Analytics Server.wixobj"  -out "D:\sources\analytics\NetVideo.Analytics.SetupServer\Domination Analytics Server.msi" -ext "C:\Program Files (x86)\WiX Toolset v3.11\bin\WiXNetFxExtension.dll"  -ext "C:\Program Files (x86)\WiX Toolset v3.11\bin\WixFirewallExtension.dll"  -ext "C:\Program Files (x86)\WiX Toolset v3.11\bin\WixUIExtension.dll" -cultures:"ru-ru" -loc "D:\sources\analytics\NetVideo.Analytics.SetupServer\bin\Debug\WixUI_ru-ru.wxl"
if ERRORLEVEL 1 @echo light.exe failed & GOTO ERROR
@endlocal
EXIT /B 0
:ERROR
@endlocal
EXIT /B 1

bootstrap batch:

set WixLocation=C:\Program Files (x86)\WiX Toolset v3.11\bin
"C:\Program Files (x86)\WiX Toolset v3.11\bin\candle.exe" -sw1026    -ext "C:\Program Files (x86)\WiX Toolset v3.11\bin\WiXNetFxExtension.dll" -ext "C:\Program Files (x86)\WiX Toolset v3.11\bin\WixBalExtension.dll" -ext "C:\Program Files (x86)\WiX Toolset v3.11\bin\WixUtilExtension.dll" "Analytics Server Bundle.wxs"  -out "D:\sources\analytics\NetVideo.Analytics.SetupServer\Analytics Server Bundle.wixobj"
"C:\Program Files (x86)\WiX Toolset v3.11\bin\light.exe" -sw1076 -sw1079   -out "D:\sources\analytics\NetVideo.Analytics.SetupServer\Analytics Server Bundle.exe" "D:\sources\analytics\NetVideo.Analytics.SetupServer\Analytics Server Bundle.wixobj"  -ext "C:\Program Files (x86)\WiX Toolset v3.11\bin\WiXNetFxExtension.dll" -ext "C:\Program Files (x86)\WiX Toolset v3.11\bin\WixBalExtension.dll" -ext "C:\Program Files (x86)\WiX Toolset v3.11\bin\WixUtilExtension.dll" -cultures:en-US
pause
oleg-shilo commented 2 years ago

Thank you, I will have a look.