[wix-users] Burn Bootstrapper Console Output

Artur Ampilogov a-artur at yandex.ru
Sun Dec 24 23:37:27 PST 2017


I understand that console and UI applications have different PE-headers.

For the users it is still inconvenient not be able to call a help page in the console.
Creating both versions, console and UI, are often driven by the business, e.g. support cmd, docker (server core) and UI installation.

For those who are interested in this, I found a solution:
1) Check that BA is running in the headless mode (no GUI) – review LaunchAction property.
2) Search for the parent process,
it can be done by calling win api NtQueryInformationProcess function: https://stackoverflow.com/questions/394816/how-to-get-parent-process-in-net-in-managed-way

3) For every iteration with the parent, grandparent, grandgrandparent process, check if it’s possible to connect with the console by calling win api AttachConsole https://stackoverflow.com/questions/807998/how-do-i-create-a-c-sharp-app-that-decides-itself-whether-to-show-as-a-console-o
4) If successfully attached – AttachConsole returns true – we can simply write to console output with Console.WriteLine(…)

Different cases were tested and they are all working fine with this solution.	

Merry Christmas,

From: Sean Hall via wix-users
Sent: Thursday, December 21, 2017 8:10 PM
To: WiX Toolset Users Mailing List
Cc: Sean Hall
Subject: Re: [wix-users] Burn Bootstrapper Console Output


I would ignore the quiet flag with the Help LaunchAction since there is no
reason to non-interactively use the Help action.

On Thu, Dec 21, 2017 at 10:20 AM, Artur Ampilogov via wix-users <
wix-users at lists.wixtoolset.org> wrote:

> Hi,
> I want to show help page when the bundle runs with `/?` or `-?` argument.
> Burn passes LaunchAction.Help to the LaunchAction property, which is great.
> The problem is to write the message to the console when a user runs the
> setup.exe in the silent mode, e.g. `setup.exe -q’. Silent mode actually
> runs out immediately, i.e. returns console command and runs setup in the
> background process. It’s possible to run ‘start /wait setup.exe -q` without
> immediate return.
> Two answers are mentioned about these feature:
> http://lists.wixtoolset.org/pipermail/wix-users-
> wixtoolset.org/2015-November/000861.html
> http://windows-installer-xml-wix-toolset.687559.n2.nabble.
> com/Burn-Console-Output-td7585792.html
> At the same time it is possible to attach .NET managed app to the parent
> console window via AttachConsole(-1).
> Example: https://stackoverflow.com/questions/807998/how-do-i-
> create-a-c-sharp-app-that-decides-itself-whether-to-show-as-a-console-o
> Burn setup.exe is a special project and I cannot attach to the window or
> path the handle of the new console back to burn, then write to it.
> Is there any other convenient way to show the users in quite mode possible
> arguments, maybe even log output to stdout?
> Thanks,
> Artur
> ____________________________________________________________________
> WiX Toolset Users Mailing List provided by FireGiant
> http://www.firegiant.com/

WiX Toolset Users Mailing List provided by FireGiant http://www.firegiant.com/

More information about the wix-users mailing list