Can I set the TRANSFORMS argument value in the custom action within the MSI ? If Yes, need to set the custom action being called at which stage ? Thanks.
Transforms can't be applied dynamically during an installation. They have to be applied at the time the installation is started. A custom bootstrapper (EXE) could use business logic to select a transform and apply it when starting the installation.
You can also embed the mst files into the _Storages table inside the MSI, and windows will auto-detect the supported transforms for you.
https://msdn.microsoft.com/en-us/library/aa368351(v=vs.85).aspx
Related
In wix 3 you could specify a condition inside the custom element.
In wix 4 the same element does not seem to accept inner text anymore. If you try to set a condition the compiler throws a The Custom element contains illegal inner text: 'NOT Installed AND NOT UPGRADINGPRODUCTCODE' error. How would one go ahead and only run the custom action during the installation now?
Condition is an attribute on the Custom element: https://wixtoolset.org/docs/reference/schema/wxs/custom/
I ended up checking the REMOVE parameter inside the custom action itself to check whether it got called during a uninstall and then run the logic accordingly.
var isUninstall = session["REMOVE"] == "ALL";
The only problem with that solution is that this way I cant make sure that the custom action logic does not run on patches as well.
Pro Tip: WiX's v3 to v4 code converter is really good. Author what you know in v3 and then convert it v4 and diff the before and after to quickly learn new changes in v4.
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.
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.
I want to pass a file name in the argument of Custom Action. These files are getting installed into the system. Can I pass the component id of these files rather than passing hard coded name?
Since Wix has provided Session variables to communicate with C# custom actions ....assign your files path in some Session variable and use it in custom action...
Make sure that the variable name should be in CAPS
I am writing an installer using wix. For silent installation using msiexec, i would like to provide few parameters from the commandline which i want to set to wix properties.
These properties I am using to enable/disable few features.
Can anyone please tell me how to read those command line properties passed to msiexec.
Using C++ Custom Action we read using MsiGetProperty
Thanks a lot..
Best Regards,
Marc
To make the property available from the command line you should define it using an upper case name. I often use a launch condition to check the properties have been passed on the command line:
<Property Id="PROPNAME" Admin="yes" />
<Condition Message="Public Property PROPNAME not passed">Installed or PROPNAME</Condition>
The Installed variable only checks for the property value on install rather than uninstall.
The command line for msiexec looks like this:
msiexec -i <msiname.msi> PROPNAME="PROPVALUE"
You should also look into the ADDLOCAL property. You can probably simplify your problem with a command line like:
msiexec /i product.msi ADDLOCAL=FEATURE1,FEATURE2,FEATURE4,FEATURE5
A Feature element can use one or more Condition elements as children. A feature condition can use installer properties directly in their formatted form, for example:
[PROPERTY_NAME] = "value"
Each feature Condition element must use a Level attribute. In your case it can be 0 so the feature is not installed when the condition is met. Basically, you will set a condition for skipping the feature.