I wrote a simple function to test custom actions. I simply unzip a file to the directory.
The custom action is executed correct if I execute the msi with
msiexec /i MyProgramm.msi /l*v thelog.txt
But if I simply execute the msi with double click to install, the custom action is not executed
<Binary Id="CustomActions" SourceFile="$(var.CustomAction1.TargetDir)\$(var.CustomAction1.TargetName).CA.dll" />
<CustomAction Id="UnzipFiles" BinaryKey="CustomActions" DllEntry="CustomAction1" Execute='immediate' Impersonate='no' Return="check"/>
<InstallExecuteSequence>
<Custom Action="UnzipFiles" After="InstallFinalize"></Custom>
</InstallExecuteSequence>
This is using WiX 3.
Launch Condition : It is common to use a launch condition to check for admin rights when invoking an MSI installation:
<Condition Message="Administrator rights are required to install [ProductName].">
<![CDATA[Privileged]]>
</Condition>
After injecting the above in your WiX source, you can test by invoking the install from a non-privileged cmd.exe
window or by launching the MSI interactively whilst logged in as a standard user.
Silent Installation : For a properly silent installation there will be no interactive error message, but the condition message will show up in the MSI log file and the system's event log.
Invoke silent installation:
msiexec.exe /i MySetup.msi /qn
Custom Actions : Custom actions are known to cause all kinds of deployment problems. Here is a long tirade on the subject: Why is it a good idea to limit the use of custom actions in my WiX / MSI setups?
Limited User Setups : A digression. It is possible to make an MSI that can install for a user without admin rights. This is not recommended, but possible if you adhere to a number of restrictions within the package. Here is a sample: https://github.com/glytzhkof/WiXPerUserSample (not extensively tested). Notice the Package element and the two attributes: InstallScope
and InstallPrivileges
.
Ok I had following problem.
I opened my command line as administrator.
So if I executed
msiexec /i MyProgramm.msi /l*v thelog.txt
I had more rights.
By opening up the command line normal, the log file showed me my problems with my action
Execute='deferred' Impersonate='no'
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.