Bob
Bob

Reputation: 459

WiX: make clickable installer that also generates verbose log files of installation

This is a really basic question, but I can't seem to find the answer. I have an installer that uses a bootstrapper. To get verbose log files when you have a bootstrapper, you simply add some arguments when you call the exe:

MyInstaller.exe /l log.txt

The problem is, the installer has to be clickable (just an icon that says MyInstaller.exe that simply needs to be clicked to run) to install -- I'm not allowed to ask the employees who will do the installation to open the command line, etc. Therefore I need a way to make it clickable and create the verbose files.

The obvious answer (the one that I will probably do) is to create a wrapper exe. In that exe, create a process that has the above string. However, I was wondering if there's a way using WiX that I could make it so that when MyInstaller.exe was clicked, it would not only install but create the verbose log files, saving me from having to create a wrapper exe.

Upvotes: 1

Views: 346

Answers (2)

Stein Åsmul
Stein Åsmul

Reputation: 42236

Simplicity: Quite frankly I like the batch file approach already mentioned. Or pushing everything out via a distribution tool (such as SCCM), but that is obviously not available for you? Just to check. Most of the below "options" are just workarounds and not preferred approaches.


Default Verbose Logging: As far as I understand verbose logging is enabled by default for all MSIs and for the Burn bundle itself? FireGiant - Burn Log File (towards bottom). Maybe that is not enough? However, it is pretty simple to tell your customers to find the logs in the TEMP folder? Just sort by modified time / date to find the logs directly after installation?

Burn Log Location: Maybe the rationale is that you need all logs put somewhere easily accessible for your customers, for example in a folder on the desktop - or in the current folder you launch the setup.exe from? Or somewhere specific - maybe even a network share? Along the lines of what is asked for in this question. If this is your own application I suppose you could use a custom bootstrapper application (I have never tried it)? But as the WiX developers explain in the similar question I linked to, such an application has access to all the log paths. I suppose you can show the log content in a dialog at the end of the install too? I assume that is possible.


Mad Approach: And by the way, hard coding an output path seems to work in a Bundle, but that is madness to use unless you build for internal, corporate use and know what the output path is guaranteed to be. Essentially adding <Log PathVariable="c:\installerlog.txt"/> under <Bundle>. I didn't test if it works for UNC paths.

Wrapper EXE: Sounds clunky, but should work I guess. I dislike self-extracting archives (security issues, unexpected runtime dependencies, etc...), but could you just put your setup.exe in a self-extracting archive with a command line to run instead of rolling your own wrapper with all its bug potential? I just wrote this answer on 7-Zip yesterday: Error Creating a 7-zip installer package.

It seems you can create a wrapper using a command like this (from the regular 7-Zip help file - not from the SDK):

 copy /b 7zSD.sfx + config.txt + archive.7z archive.exe

The command line from the 7-Zip Help File.

  • Section: "-sfx (Create SFX archive) switch".
  • Path (in help file): Command Line Version => Switches => -sfc (Create SFX Archive.)

config.txt:

;!@Install@!UTF-8!
Title="Tester"
BeginPrompt="Do you want to install Tester?"
ExecuteFile="setup.exe"
ExecuteParameters="/l \\Server\Logs\Tester\Tester.log"
;!@InstallEnd@!

That is just an untested mock-up to give you an idea of how it could work. Rolling your own EXE might work OK for in-house applications, but for world-wide distribution I am always concerned with regards to really surprising and unexpected bugs (odd runtime dependencies, localization issues, weird OS incompatibilities, security software interference is also a huge one, etc...).

Launchers from established deployment tools have been tested in real-life - often by hundreds of thousands of users - or even millions of users - a hard thing to match with home-made solutions I think.

I don't trust self-extracting archives nearly as much as a proper setup.exe launchers from established deployment tools, but they are likely to be better than home-made solutions by "sheer mileage" and prior real-world testings - provided you choose an established tool. I am not sure 7-Zip is the best tool in this case. Maybe another, more established tool such as WinZip or WinRAR? I am not quite sure.


Some Links:

Upvotes: 1

Feuerwehrler
Feuerwehrler

Reputation: 51

I'm afraid I never seen any way to configure logging with WIX by default.

But do you really need logs of every installation? Are you also not allowed to ask the employees to call the installer again from comandline if the installer fails when executing by doubleclick? This is my prefered way.

I don't know if this will be possible to you but there is another way by modifying the regestry or working with group policies: https://support.microsoft.com/en-us/help/223300/how-to-enable-windows-installer-logging

If this all does not work I think you should really wrap the installer. Maybe a batchfile to call the installer will be enough.

Regards, Patrick

Upvotes: 1

Related Questions