Custom error message using WiX setup - wix

Using a WiX setup, how do I show a custom error message dialog where it shows all the installation checked processes as tick marks and the failed check processes as close marks?
And if any file checking conditions are not met. That is, if any of the installations shows a close mark then how do I force the user to stop the installation setup process?

You can do this using properties. Use the Bitmap control to set the icon.
<Binary Id="RightClick" SourceFile="Resources\Right.jpg" />
<Binary Id="WrongClick" SourceFile="Resources\Wrong.jpg" />
Use SetProperty or CustomAction to set the property value based on a condition and pass the value to the Bitmap control.
<PropertyRef Id="NETFRAMEWORK40FULL" />
<Property Id="NETFramework_Icon" Value="WrongClick" />
<SetProperty Id="NETFramework_Icon" Value="RightClick" After="AppSearch">NETFRAMEWORK40FULL</SetProperty>
In dialog,
<Control Type="Bitmap" Id="NETFramewor40ico" Width="20" Height="20" X="240" Y="70" Text="[NETFramework_Icon]" />
Regarding the second query, disable the next button if any prerequisites are not installed or throw a custom error for silent installation.

Related

Switches in WixShellExecTarget

from a Wix installer package I am starting one of the installed programs at the end of the setup, according to http://wixtoolset.org/documentation/manual/v3/howtos/ui_and_localization/run_program_after_install.html:
<Property Id="WixShellExecTarget" Value="[#myapplication.exe]" />
<CustomAction Id="LaunchApplication" BinaryKey="WixCA" DllEntry="WixShellExec" Impersonate="yes" />
I now need to include a switch ("/X") to start the program with and failed to find out how to do that (adding it to Value disables the start of the program alltogehter) - any advice? Thanks!
WixShellExecTarget must be only the path of the executable/document.
There's no support to add arguments. For that, use a "normal" exe custom
action instead of WixShellExec.
Because a more typical use case is to launch a document (like a
readme.html or .pdf). WixShellExec was designed just for that purpose.
http://windows-installer-xml-wix-toolset.687559.n2.nabble.com/Passing-command-line-arguments-to-an-app-launched-after-setup-td1366362.html
You could replace your custom action with something like:
<CustomAction Id="LaunchApplication"
Impersonate="yes"
FileKey="[Id for File element that was installed]"
ExeCommand="/X"
Return="asyncNoWait" />
I guessed on some of the attributes that you'd want, but you could use the Wix CustomAction element reference page for more information. I think you want custom action type 18 (to run an executable copied during this installation), so this example should help as well.

Remove reference from Add/remove program with Wix

I have created a wix build, which does the following
1. Install the files in temporary location.
2. Then I call a custom Action to copy the files into a different location and does messaging of some of the config files.
3. Display a message to user that installation is complete.
4. and then Exit the MSI.
PROBLEM: The reference to the MSI exists in control panel add remove program.
How can I remove the reference of the project from add remove program?
Is it possible within the same WIX build?
What are the alternatives to achieve it?
Thanks,
M
Assuming that you want to prevent your application from being displayed in the Add or Remove Programs list of Control Panel.
Then you need to set property ARPSYSTEMCOMPONENT in to 1.
<Property Id="ARPSYSTEMCOMPONENT" Value="1" />
Read more about ARPSYSTEMCOMPONENT
And also if you want it to show into add or remove programs, but remove or modify functions disabled then use ARP ENTRY properties.
<Property Id="ARPNOMODIFY" Value="1" />
<Property Id="ARPNOREPAIR" Value="1" />
<Property Id="ARPNOREMOVE" Value="1" />
Refer for More Info: ARP ENTRY
And if you don't want your program to be uninstall using msiexec also you can add condition like
<Condition Message="Uninstall is not supported">REINSTALL or Not Installed</Condition>.
Uninstall using msiexec.exe /x will give pop-up saying uninstall is not supported and will quit.

Starting a second installer WIX

I have recently started creating installers in wix so i'm pretty new. Having a problem, When the user clicks a button i would like a second installer to start using a .exe file. However I cannot get my code to do this, im a bit confused as to which bit of code goes where but i have these three parts:
<Binary Id="HaspInstaller" SourceFile="visual studio 2010\Projects/ExampleInstaller/ExampleInstaller/bin/Debug/HASPUserSetup.exe" />
<CustomAction Id="HaspSetup" BinaryKey="HaspInstaller" ExeCommand="-switch"
Execute="deferred" Return="check" HideTarget="no" Impersonate="no" />
<Control Id="Hasp" Type="PushButton" X="40" Y="60" Width="56" Height="34" Bitmap="yes" Text="HaspImage" >
<Publish Event="DoAction" Value="HaspSetup" />
</Control>
Any help would greatly be appreciated..:)
N
That will not run when you click the button due to the Execute attribute set as deferred. Mark it as immediate and it will run as soon as you click the button.
Deferred is for use when elevation is required and has to be scheduled into the InstallExecute sequence.
Take a look at http://wix.sourceforge.net/manual-wix3/qtexec.htm which is the quiet execute custom action and the page explains nicely how to set it up for both deferred and immediate execution.
Also if that exe file is a bootstrapper for another msi, you will not be able to run it at all due to the fact that you will already be in one MSI transaction. In that case use burn to bundle the different installers into a single-installer user experience.

Wix custom UI for SQL Database installation

This is my very first wix project. I downloaded wix 3.6 rc.
My installation project includes 2 wcf and 1 silverlight projects. Everything works fine with default Wix UI. But now that I need to add sql database to it. It works fine with default values like below:
<Component Id='SqlComponent' Guid='8B72C159-1477-4A58-AFAE-E94D756BFFA6'>
<CreateFolder/>
<sql:SqlDatabase Id='SqlDatabase' Database='master' Server='.'
CreateOnInstall='yes' DropOnUninstall='no' ContinueOnError='yes'>
<sql:SqlScript Id='CreateTable' BinaryKey='CreateTable' ExecuteOnInstall='yes' />
<sql:SqlScript Id='CreateTable1' BinaryKey='CreateTable1' ExecuteOnInstall='yes' />
</sql:SqlDatabase>
</Component>
But I need to present a user interface for sql database path, database name, user name and password, if user and password is not specified then use windows user.
Just to see how to add a custom ui I tried the following:
but it displays the custom ui right away. But I want it to show specifically for sql database installation only.
<Control Id="Title" Type="Text" X="15" Y="6" Width="200" Height="15" Transparent="yes" NoPrefix="yes">
<Text>Ready to Install</Text>
</Control>
<Control Id="Install" Type="PushButton" X="304" Y="243" Width="56" Height="17"
Default="yes" Text="Install">
<Publish Event="EndDialog" Value="Return" />
</Control>
I guess, once I get it to show the custom UI exactly where I want, my next requirement is going to be able to get user input for database path, name, user and password and pass that information to the script. I'm not sure how to do that either.
Read up on the WiX UI extension in the .chm. Choose the dialog set that is most appropriate for your installer. Then you can customize it accordingly. Let's assume you want to customize the WixUI_Advanced dialog set:
Download the WiX source code
Navigate to the source code for the UI extension located in src\ext\UIExtension\wixlib.
Copy and rename the file *WixUI_Advanced.wxs* to something different such as *WixUI_Advanced_Custom.wxs*.
Open the .wxs file and be sure to rename the UI Id to <UI Id="WixUI_Advanced_Custom">.
Add *WixUI_Advanced_Custom.wxs* to your setup project.
Now you can reference your custom dialog set just like you would reference the other dialog sets in the UI extension. But the UI is not quite customized, it just provides the same functionality as the WixUI_Advanced dialog set. To add a new dialog, you need to create a new .wxs using the wix source as an example. Look at any of the dialogs in src\ext\UIExtension\wixlib for help. Then reference your dialog in *WixUI_Advanced_Custom.wxs* by adding and modifying the <Publish> elements to determine when your dialog is shown.
Finally I found an eye opener article on wix here How to add custom UI
After a long struggle to understand how wix works, the above link to codeproject helped me understand. Especially the part that explains creating UI (MyWebUI.wxs in that article) was the life saver.

Setting ALLUSERS in WiX for per-user or per-machine installation context

I use WiX 3.5. My installer should enable both per-user and per-machine installation. I would like to achieve that by using radio buttons ("Everyone" and "Just me").
I found a couple of references on the Internet:
Selecting current-user or all-users install: Adding a user interface, part of Yet Another WiX Tutorial - Part 2 - Adding the UI.
Set the ALLUSERS property to an empty string: Using WiX 3.0 to create a per-user MSI that does not prompt for elevation on Windows Vista
If I understand that correctly my installer should set ALLUSERS property to 1 for per-machine installation and to "" (empty string) for per-user installation.
My problem is no matter what I try ALLUSERS is always set to 1. Even when I don't set it at all!
Here is a couple of things I tried:
<Control Id="UserSelection"
Type="RadioButtonGroup"
X="26"
Y="115"
Width="305"
Height="45"
Property="ASSISTANCE_USERS"
Text="ASSISTANCE_USERS">
<RadioButtonGroup Property="ASSISTANCE_USERS">
<RadioButton Value="cur"
X="0"
Y="0"
Width="295"
Height="16"
Text="Just me" />
<RadioButton Value="all"
X="0"
Y="20"
Width="295"
Height="16"
Text="Everyone" />
</RadioButtonGroup>
</Control>
and then setting the ALLUSERS based on ASSISTANCE_USERS:
<Publish Property="ALLUSERS"
Value="{}">ASSISTANCE_USERS = "cur"</Publish> <!-- set null value -->
<Publish Property="ALLUSERS"
Value="1">ASSISTANCE_USERS = "all"</Publish>
However, ALLUSERS is always 1.
I also tried just setting ALLUSERS to an empty string:
<Property Id="ALLUSERS" Secure="yes"/>
This should set ALLUSERS to "", yet it stays "1"
Once I'm able to set ALLUSERS, I should be able to use HKMU for per-user and per-machine installtion.
Check a verbose log (using /l*vx): MSI logs every property change so you can see when ALLUSERS is being set.