<InstallUISequence>
<Custom Action="myActionid"
Before="ExecuteAction">NOT Installed</Custom>
</InstallUISequence>
i use this to set when my customAction will run but it doesent seem to run when i want it to.
in verbrose log i see this
*
*
My action runs too soon i need it to run right before Execute action (or between the middle bold part and executeaction)
because after that the properties change and i cant get the right values
alternatively make the properties stop from changing that would also work.
the properties are copies of INSTALLDIR meaning i've copied BrowseDlg and made the installdir dialog into a dialog that asks for three paths i need for my program. i will post that code too if you think its necessary but it feels like i could be able to just specify when my custom action runs to get the right values!
thank you for answers :)
Alright i still dont know how to set mycustomAction to the specific runtime that i wanted but i dont need to anymore because i found out why my Properties like the INSTALLDIR was changed by costfinalize
i dont know the reason why it works this way but i had my directories with small letters in the id and then costfinalize changed them back to the default after the install sequence
so having all caps like this
<Directory Id="SPCSFOR" Name="Företag">
</Directory>
<Directory Id="SPCSGEM" Name="Gemensamma filer">
</Directory>
<Directory Id="VISMAADMIN" Name="SPCS Administration">
</Directory>
was the last piece of making my own InstallDirDlg working more like the original and the properties stays the way the user changes them with BrowseDlg
and after that it was easy for my to just set mycustomAction
<InstallExecuteSequence>
<Custom Action="myActionid"
After="InstallFinalize">NOT Installed</Custom>
</InstallExecuteSequence>
like that and read the properties from there instead and no problems trying to time it just right to get the values i wanted!
Related
I am looking for a suggestion How to Override the property value in the transform file in WIX during Installation.
Basically we have a property - for example USE_WINDOWS_AUTH
Consider that, Transform file (.mst) has USE_WINDOWS_AUTH=1
Now the requirement is, let the property value in transform be whatever, but WIX code should override it to USE_WINDOWS_AUTH=0 .
Reason for such requirement is, there is an enhancement happened in the product and clients are still using old properties , which is causing us lots of issues.
So the installer should ignore/override the property value of .mst file.
We tried After="CostFinalize", Before= "InstallInitialize" and etc. NO luck
<SetProperty After="CostFinalize" Id="USE_WINDOWS_AUTH" Value="0"/>
Another observation is, we are facing issue in silent mode (/quiet), but not interactive mode..
not sure what I am missing..
Any suggestions or advise please..
Please let me know if I can provide you any other information on this.
Thanks In Advance..
Rajkumar.
After further investigation seems to be below logic is helping me to serve the requirement. Hence Posting here.. which may help someone looking for some clues to the similar requirement.
<CustomAction Id='ModifyWindowsAuthValue' Property='USE_WINDOWS_AUTH' Value='0' Execute='immediate' />
<InstallExecuteSequence>
<Custom Action='ModifyWindowsAuthValue' Before="CostFinalize"/>
//existing other actions
</InstallExecuteSequence>
I have a variable in my burn bundle as such:
<Variable Name="DemoVariable" Type="string" Value="ChangedProperty" bal:Overridable="yes"/>
Which is then used with an MSIProperty:
<MsiPackage SourceFile="testFile.msi" Id="DemoPackageId_1" Cache="yes" Visible="no">
<MsiProperty Name="PassedProperty" Value="[DemoVariable]"/>
</MsiPackage>
In my testFile.msi I have a property and custom action:
<Property Id="PassedProperty" Value="Unchanged"/>
<Binary Id="CustomActionDll"
SourceFile="CustomAction.CA.dll"/>
<InstallExecuteSequence>
<Custom Action="ShowMessageBoxCA" Before="CostFinalize"/>
</InstallExecuteSequence>
<CustomAction Id="ShowMessageBoxCA"
Return="check"
Execute="firstSequence"
BinaryKey="CustomActionDll"
DllEntry="ShowMessageBox"
HideTarget="no" />
The ShowMessageBox function literally just calls:
MessageBox.Show(session["PassedProperty"])
The problem is that the message box shows the message "unchanged". I looked through the log file for the installation and I can see that the PassedProperty is being changed sometime after InstallFinalize finishes. This is obviously too late for my custom action which takes place before CostFinalize.
Is there a way to make Burn change the MSIProperty earlier in the process rather than making the custom actions take place later?
Edit:
Okay so I found the answer but I can't post it yet so I'll leave the information here in an edit.
Basically MSI's have Public and Private properties. Only public properties are declared before the install phase takes place. Public properties must be all uppercase so to fix my issue I just replaced all instance of "Passed_Property" with "PASSED_PROPERTY" and it works fine.
So the problem I had was that I was creating my properties as private properties, which aren't available until after the installation. To make your properties public and therefore available throughout the whole install, they need to be Uppercase.
<Property Id="PASSED_PROPERTY" Value="Unchanged"/>
https://msdn.microsoft.com/en-us/library/aa370912(v=vs.85).aspx
As soon as I made them public the properties were changed by Burn.
I have build an installer to install machine software. However the user is required to fill in one value (the machine ID) this because it needs to replace a value already present in the .INI file. The code to replace the value is no problem since I already got it working.
However I dont know how to get the value (for example: DE123654) from the WIX installer in the script that is being executed to replace the value using a WIX custom action. I created a Custom form for asking the value and the code i use to get the value is as following:
<Control Id="InputField" Type="Edit" X="20" Y="100" Width="140" Height="18" Property="MachineIdNumber" Text="{80}"/>
I found this code on this website, however I don't know how to get the value from here into my script or how I can make the script look up the value that has been entered. any suggestion on how I can achieve this?
I ask for the MachineID at the beginning of the installation process, so the value is known before the actual installation process starts.
the script is embedded in the installer and is being executed at the end of the installation process since the file that needs to be altered is already at the correct location on the targer system.
Thanks in advance,
You need to create a custom action to set the properties you want to pass and the Property value must be the same as the Id of the custom action calling the script, this way:
<Product ...>
<CustomAction
Id="SetProperties"
Property="ScriptCA"
HideTarget="yes"
Value="[MachineIdNumber];[OtherProperty]"
/>
<CustomAction
Id="ScriptCA"
BinaryKey="CustomActionsLib"
DllEntry="ScriptMethod"
Execute="deferred"
Impersonate="no"
Return="check"
/>
<InstallExecuteSequence>
<Custom Action="SetProperties" Before="ScriptCA" />
<Custom Action="ScriptCA" Before="InstallFinalize">NOT REMOVE="ALL"</Custom>
</InstallExecuteSequence>
</Product>
I have an .exe embedded inside my MSI installer which I'd like to somehow call directly from the installer, before the the 'InstallFiles' action occurs.
It's defined as follows:
<CustomAction Id="LaunchInstallManager_TryUninstall" Return="ignore" Directory="INSTALLFOLDER" Execute="deferred" Impersonate="no" ExeCommand=""[#fil713F8F6A7BC9B98857D779B9B29873E1]" /someargument"></CustomAction>
<Custom Action="LaunchInstallManager_TryUninstall" Before="InstallFiles">NOT Installed</Custom>
But upon looking at the logs, it looks like it's (trying to be) called from the install destination.
Is such a thing possible?
It is possible, but in a different way. The 'run EXE' type of custom action will always search for the executable on the target system. Thus, if your executable is installed along with your app, it is not an option.
Here is another way:
First, author your EXE as a <Binary> instead.
It is as easy as <Binary Id="MyEXE" SourceFile="PATH\TO\EXE" />.
Add a DLL deferred custom action, which will extract the binary, run it with parameters and clean up afterwards.
This post can give you an idea how to extract the binary using C# and DTF. Besides, in case you need to pass parameters, make sure you do it the right way for deferred custom action.
Finally, remember that each deferred custom action (that is the one to change the target system) must have corresponding rollback action. This article might give you some hints on how to test the direct and rollback behaviors of your custom actions.
I want perform custom action after files are copy in destination folder.
In custom action i run copied script file so give me error file not found.
<CustomAction Id="RunDBScript"
BinaryKey="CA"
DllEntry="RunDBScript"
Execute=" immediate"
Return="check" />
<Custom Action="RunDBScript" After="InstallFiles">
<![CDATA[NOT Installed]]>
</Custom>
this custom action give an error file/directory not found. so this action call before file copy.
so, how to call custom action after file copy?
I am not understand why this custom action call before InstallFiles even though i am specified After="InstallFiles".
Move your custom action after InstallFinalize. This is the only place in InstallExecuteSequence where Immediate actions can be executed after installing the product files.
When you use deferred custom actions, you must access values through session.CustomActionData["propertyname"].
Session dictionary values can be read only by immediate custom actions, where the execution script is being written.
The deferred custom actions are executed at script running time, so the project properties are no longer available.
To make use of it, you must implement a double custom action in order to provide the desired properties for the real custom action.
Follow the bellow example:
<CustomAction Id="CustomActionID_Data" Property="CustomActionID" Value="INSTALLDIR=[INSTALLDIR];OTHERPROPERTY=[OTHERPRPJECTPROPERTY]"></CustomAction>
<CustomAction Id="CustomActionID" BinaryKey="FILEBINARYID" DllEntry="METHODNAMEATCUSTOMACTION" Execute="deferred"></CustomAction>
At this example, you need to call at InstallExecutionSequence the custom action "_Data" and after call the real one, so the first "_Data" will se the desired properties. Then you can access those properties on your code using session.CustomActionData[""].
Just complementing, bellow is an example of how to call the custom actions at InstallExecuteSequence.
<Custom Action="CustomActionID_Data" After="InstallFiles">NOT (REMOVE="ALL")</Custom>
<Custom Action="CustomActionID" After="CustomActionID_Data">NOT (REMOVE="ALL")</Custom>