How to remove Custom Eventlog on uninstall? - wix

In my current assignment I am having a requirement where I need to create custom eventlog during installation and uninstall this custom eventlog during uninstallation.
I am able to create custom eventlog during installation, but I am not able delete it during uninstallation. I could not find any documentation on how to delete the custom eventlog.
Can somebody please let me know is it possible or not? If possible, please guide me on how to achieve it.

I suppose you're trying to achieve this with <util:EventSource /> element. If that's the case, then the component hosting that event source should regulate its install / uninstall behavior.
If a component is scheduled for the installation, the event source will be created. If a component is to be uninstalled, it removes the event source altogether. At least, this is the way most elements work when placing inside the component.
If that's not the case, edit your question to add more details and some code, as I mentioned in the comment above.

Related

Is it possible to customise react-native-media-controls styling?

I have a video component that uses react-native-video with react-native-media-controls, I want to be able to customise the Styling of the controls. Is this possible to do on react-native-media-controls?
<MediaControls
duration={this.state.duration}
isLoading={this.state.isLoading}
mainColor="orange"
onFullScreen={this.onFullScreen}
onPaused={this.onPaused}
onReplay={this.onReplay}
onSeek={this.onSeek}
playerState={this.state.playerState}
progress={this.state.currentTime}
toolbar={this.renderToolbar()}
/>
I've checked the #react-native-media-controls library. The author just made the "mainColor" style is customizable. Actually it could be customizable if you really need an emergency issue I can fork it and make it customizable, however, this PR takes time to merge. However, you can install it with my fork. Do you need it?
UPDATED:
I've updated the library and opened a PR.
https://github.com/charliesbot/react-native-media-controls/pull/17
If someone needs to use it with updated version, it is available on my repo until this PR will be merged.

WiX - passing parameter from MSI to Xeam bootstrapper application

I am using a WiX bundle with Xeam Visual Installer as a bootstrapper UI application.
What I would like to do is set some variables inside the Custom Actions that my MSI is running, and I have figured out how to do that. I can see in my logs that the variables are being set.
My problem is I hoped that I would be able to read these variable and display them on the last page of my bootstrapper UI. Out here the variables still show as empty strings.
If you are familiar with Xeam, I am trying to access them like this:
MyProp = Bootstrapper.Engine.StringVariables["MY_PROP"];
Similar to the way you read and set properties during the initial bootstrapper workflow, before everything is sent to the MSI.
Has anyone else tried to do this. Should it be possible or are there any other solutions you can suggest?
This is apparently not possible. The solution is to use the registry instead.

add hyperlink in wix installer error message

I'm trying to add hyperlink inside of DisallowUpgradeErrorMessage (from here http://wixtoolset.org/documentation/manual/v3/xsd/wix/majorupgrade.html):
<MajorUpgrade AllowDowngrades="no"
DisallowUpgradeErrorMessage='Older version of MWL installed. Please follow https://example.com/uninstall.html'
/>
I already try to create HTML hyperlink inside message, but got error, something like
"invalid character inside of attribute"
I replace <> characters with < and >, but it not work (shown as plain text). Is there any other ways to do this?
The default WiX dialogs do not support hyperlinks in their text so you will have to create your own custom UI rather than relying on the condition elements. You can find an example of how to do this here.
However, for the case you have mentioned you can have WiX automatically uninstall the previous version of your software. In cases such as this I have found the Upgrade element to be more useful than MajorUpgrade, it allows for granular control of conditions and actions. You can view an example of using the Upgrade element as well as forcibly removing existing products here.

WiX: returning a value from exepackage

I have been asked to add a function to an existing WiX package.
Specifically, I need to run a small c# application and return a single int back to WiX to conditionally control further actions.
I can see from ExePackage help that there is an ExitCode, but this is an enumeration of success, error, scheduleReboot or forceReboot.
I have googled quite a bit and I am wondering if I am missing the point. I can probably implement the C# process internally within WiX to get the user to provide the information I need, but the existing package already has custom ExePackages written in C# with a particular style, so I'd like to stay with that if I can. (The existing packages don't return any needed values)
Can I do this, or do I need to try and operate entirely within WiX?
For reference, one of the existing packages looks like this:
<ExePackage
SourceFile="..."
DisplayName="License Key"
InstallSize="0"
Permanent="yes"
InstallCommand="/ignoreIfLicensed"
RepairCommand="/ignore"
UninstallCommand="/ignore"
/>
The reference to <ExePackage ...> implies you want the condition to operate in a WIX bundle. In this scenario I think your options are limited and you can only map the return value of an ExePackage to global behaviour like forceReboot.
Do you have any <MsiPackage...> references? If you have, you could move the conditional behaviour inside each <MsiPackage...> using a Custom Action to call the exe and set a property. The property can then be used as a condition in each <component...> you want to conditionally install. See Using a WiX custom action to set a property's value for more information on custom actions setting properties.

Unable to delete deployed file during installation with WIX installer

In our WIX installer project, we need to generate a new file, let's call it FileB, based on a deployed file, called FileA in a managed custom action function. In another word, in the component declaration, I declare the FileA. While in a custom action (which happens at commit phase), I need to generate FileB based on FileA. After that, since FileA is no use anymore, I want to delete it in the same custom action.
And here comes the problem: with the default installation folder, which is Program Files, the normal user is not allowed to add file (generate FileB) into this folder in the custom action (I am not 100% sure I am right, but it is the case in my test. And if I install it in another folder, there is no problem at all). So I think I need to give permission of creating file. In order to do that, I add a CreateFolder element to the component which includs FileA. The whole component declaration is something like this:
<Component Id='COMPONENT_NAME' Guid='MY_GUID'>
<!--OTHER FILES IN THE COMPONENT-->
...
<CreateFolder Directory='INSTALLDIR'>
<Permission CreateFile='yes' User='Everyone' GenericAll='yes' Delete='yes'/>
</CreateFolder>
<File Id='MyFileA' Name='FileA' Source='PATH_TO_FILEA' KeyPath='no' >
<Permission GenericAll='yes' User='Everyone' Delete='yes'/>
</File>
</Component>
The component actually belongs to a component group, which resides in INSTALLDIR. The reason there is other files in the same component element is because I want another File to be the keypath, so that deleting FileA would not cause a problem of that. And now the generation of FileB is working fine. But later in the same custom action, I am experiencing the problem when deleting FileA. It just says that ": Access to the path 'DEPLOYMENT_PATH_TO_FILEA' is denied." I thought the problem lies in the FileA declaration, that's why I added the Delete='yes' in the Permission element under File, hoping to make it OK to delete it (although I am not sure whether this means in the installation it is possible to delete). But still I get this error. Can anyone tell me what I did wrong?
Another question is, I really don't know what is the purpose of those CreatFolder elements. For one thing: if the aim is to create the directory structure, I think the (nested)Directory elements already do that. And why to have such element under Component element when most of the time you probably want the directory structure to be separated with component structure(the components just use directory reference to refer to correct directory). Secondly, the default Directory property of CreateFolder is the parent Directory where the component resides in. But it is common that more than one components reside in the same directory, like what I have here: multiple components are in the same component group, whose directory element references to INSTALLDIR. So only one of these components has the CreateFolder element, whose Directory property in my case is the parent directory of all those components. It is really hard to understand this structure. I guess I have some misunderstanding of the CreateFolder element. Can someone enlighten me to usage of CreateFolder? Thanks!
Thanks!
A number of issues to address here. First, you should know that Commit phase custom actions don't execute if rollback is disabled. You should really have an deferred and rollback custom action.
Second, you can't tell MSI to install a file and then go delete it. That's counterproductive and just causes servicing issues down the road. A better solution ( I'm assuming you are using a WiX DTF managed custom action ) is to include FileA as a content item in the custom action project. This will cause the file to exist in the current (temp) directory of the custom action while it execute. You can then generate fileb. For rollback, you can delete fileb.
You'll also need to author a RemoveFile element to teach MSI to delete the file on uninstall. Otherwise it won't since MSI doesn't know anything about fileb created by your out of process custom action.
Otherwise it'd be useful to know what the contents of fileb are. It would be easier to implement if this was an xml file that could be installed as fileb and then transformed using the xml wix extension.