Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to set ManagedAction execute before Appsearch #337

Closed
Torchok19081986 opened this issue Apr 5, 2018 · 9 comments
Closed

How to set ManagedAction execute before Appsearch #337

Torchok19081986 opened this issue Apr 5, 2018 · 9 comments

Comments

@Torchok19081986
Copy link

Torchok19081986 commented Apr 5, 2018

Hi Oleg, is there some posibility to set ManagedAction before Appsearch ?
I have to check if Windows OS is Server and then check if I can install my Application on it. I create ManagedAction and add MA to prject
.. new ManagedAction(CustomAction.CheckOS, Return.check, When.Before, Step.Appsearch, Condition.NOT_Installed), then during install MA will be executed and return false. After that i got Wizard Message . "... System was not modified." This works fine. How do i execute MA before show WelcomeDialog and show some Message like "OS not Windows Server Installer cant be executed on this OS " something like that ?

@oleg-shilo
Copy link
Owner

oleg-shilo commented Apr 6, 2018

If you are using ManagedUI you can use two methods that are executed before the UI is displayed:

project.UIInitialized += ...
project.UILoaded += ...

Have a look at CustomUISequence, which shows how to check the product compatibility and prompt the user.

@Torchok19081986
Copy link
Author

Torchok19081986 commented Apr 10, 2018

Thanks Oleg. I tried it and works good. Only one question. if i set Result to Failure exit dialog not apears with my message, that components are not installed or not found. how can i set this ?

@oleg-shilo
Copy link
Owner

You will need to set e.ManagedUI.Shell.ErrorDetected.

This is how it's done in "MajorUpgrade" sample:

project.UIInitialized += (SetupEventArgs e) =>
{
    Version installedVersion = e.Session.LookupInstalledVersion();
    Version thisVersion = e.Session.QueryProductVersion();

    if (thisVersion <= installedVersion)
    {
        MessageBox.Show("Later version of the product is already installed : " + installedVersion);

        e.ManagedUI.Shell.ErrorDetected = true;
        e.Result = ActionResult.UserExit;
    }
};

@Torchok19081986
Copy link
Author

Torchok19081986 commented Apr 11, 2018

Thanks. Works really great. How can i set my message in exitdialog in descrptionpart? I get always standard error. System was not modified .... on ExitDialog.
I need to show something like "Setup was aborted, because systemrequirements are not accomplished. " .

@oleg-shilo
Copy link
Owner

The UX of the ManagetUI dialogs mimics stock UI that comes with MSI/WiX. And that UX does not allow runtime customization of the exit dialog. I always shows the the standard "outcome description" and the specific error is displayed earlier when the error is detected.

Thus, currently, you cannot do it directly. The only option you have is to have a custom UI sequence and customize your ExitDialog and show the description either from custom global storage (type static property, MSI property, environment variable) that is initialized in the UIInitialized event handler.

Saying that kind of see here an opportunity to improve the dev experience.
I am re-qualifying this issue into 'enhancement' and the next release will have optional API just fro cases like yours:

e.ManagedUI.Shell.CustomErrorDescription = "Setup was aborted, because system " +
                                           "does not meet deployment requirements.";

oleg-shilo added a commit that referenced this issue Apr 11, 2018
- Added `SetupEventArgs.ManagedUI.Shell.CustomErrorDescription`
oleg-shilo added a commit that referenced this issue Apr 11, 2018
-----

v1.6.4.0
* Implemented localization of the Feature's description text (ManagedUI)
* AutoEllipsis enabled for long Feature's label text
* Issue #337: How to set ManagedAction execute before Appsearch
  Added `SetupEventArgs.ManagedUI.Shell.CustomErrorDescription`
* Add dual signing of binaries.
* Issue #333: FeaturesDialog drawing issues
* Added sample for "Issuae #324: Capture Msi error in bootraper"
* Added support for bootstrapper generic items (`Bundle.Items`): Triggered by #315
* Issue #270: Deduplication of files added with wildcards sample dedup
* Added additional resolution algorithm for FileShortcut location, which now can be both dir id and dir path. Triggered by #307
* Issue #307: Fileshortcuts starting with an integer; Removed '_' inserted by the 'start digit in the name' check for composite Dir Ids (e.g. ProgramMenuFolder.1My_Product);
* Issue #180: Multiple root level directories. Added `InstallDir` class
* Added `FileShortcut` constructor that does nor require 'location' parameter. It automatically creates the shortcut in the parent `Dir`.  Triggered by #307.
* Package WixSharp.bin: added copying nbsbuilder.exe to output folder
* NuGet package(s): Added <references> section to register only managed dlls.
  WixSharp.bin.targets file is added to copy unmanaged dll to the output folder.
* Implementation XmlFile Element
* Issue #304: Localization bootstrapper via theme file
* Added optional generation of the XML id attribute for `Bootstrapper.Payload.Id`
* Issue #303: ExternalTool method ConsoleRun(Action<string> onConsoleOut) pass invalid unicode strings to onConsoleOut
* Added `ExternalTool,Encoding`. The default value is `Encoding.UTF8`.
@Torchok19081986
Copy link
Author

Thanks. I will wait for new Release 1.6.4.0.

@oleg-shilo
Copy link
Owner

All done. You can update you NuGet packages now

@Torchok19081986
Copy link
Author

Hallo Oleg, i just tested new e.ManagedUI.Shell.CustomErrorDescription with my Description "Setup was aborted, because system does not meet deployment requirements."; Works great. Thanks.

@oleg-shilo
Copy link
Owner

Great. Closing the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants