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

WixQuietExecAction and deferred #206

Closed
Xaddan opened this issue Nov 24, 2017 · 2 comments
Closed

WixQuietExecAction and deferred #206

Xaddan opened this issue Nov 24, 2017 · 2 comments

Comments

@Xaddan
Copy link
Contributor

Xaddan commented Nov 24, 2017

WixQuietExecCmdLine does not work if Execute is set deferred.

new WixQuietExecAction("notepad.exe", @"C:\boot.ini")
{
   Step = Step.CreateFolders,
   When = When.After,
   Execute = Execute.deferred,
}

In the logs there are such errors:

WixQuietExec:  Error 0x80070057: Failed to get command line data
WixQuietExec:  Error 0x80070057: Failed to get Command Line
WixQuietExec:  Error 0x80070057: Failed in ExecCommon method

The thing is that the Property name does not match the ID CustomAction

<CustomAction Id="Set_Action1_WixQuietExec_notepad.exe" Property="WixQuietExecCmdLine" Value="&quot;notepad.exe&quot; C:\boot.ini" />
<CustomAction Id="Action1_WixQuietExec_notepad.exe" BinaryKey="WixCA" DllEntry="WixQuietExec" Return="check" Execute="deferred" />
@Xaddan
Copy link
Contributor Author

Xaddan commented Nov 24, 2017

Also I can not change ID.

new WixQuietExecAction(new Id("Start_notepad_exe"), "notepad.exe", @"C:\boot.ini")
{
   Step = Step.CreateFolders,
   When = When.After,
   Execute = Execute.deferred,
}

or

new WixQuietExecAction("notepad.exe", @"C:\boot.ini")
{
   Id = "Start_notepad_exe",
   Step = Step.CreateFolders,
   When = When.After,
   Execute = Execute.deferred,
}

ID still remains auto-generated.

@oleg-shilo
Copy link
Owner

The only real problem is the ID assignment. Fixed. now.

As for deferred actions problem, it is how MSI works. None of the session properties can be accessed from the deferred actions. An since WixQuietExec is relying on property to get the command line to be executed, it is heavily affect by the deferred actions limitation.

WixSharp lets you easy tunnel properties to the deferred environment. However, WixQuietExec is such clumsy attempt to solve a very simple problem in such a convoluted way. You are much better off with DeferredCustomAction or even project events:

project.AfterInstall += (SetupEventArgs e)=>
{
    Process.Start("notepad.exe", e.InstallDir.PathCombine("manual.txt"));
}

Have a look at "Setup Events" sample.

@Xaddan Xaddan closed this as completed Dec 2, 2017
oleg-shilo added a commit that referenced this issue Dec 3, 2017
----
* Added IniFile element support
* Add ProgressText element support
* Add UrlReservation element support
* Add CustomActionRef element support
* Add CustomAction rollback customization
* Issue #201: WixStandardBootstrapperApplication ShowVersion
* Issue #198: Files.AddRange not work; Extension method `AddRange` is renamed in `Combine`
* Issue #208: Unable to sign msi file
* Issue #214: Add InstallPrivileges property to project
* Issue #206: WixQuietExecAction and deferred
* Custom hash based ID-generation algorithm has been embedded as `WixSharp.Project.HashedTargetPathIdAlgorithm`
* Separated `Project.CustomIdAlgorithm` and `Compiler.CustomIdAlgorithm`
* Added `Compiler.AutoGeneration.IsWxsGenerationThreadSafe`
* `Compiler.AutoGeneration` settings object made read-only
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