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.
Related
I have the following code in my wxs file:
<UI>
<Dialog Id="CustomTextA"
Width="370"
Height="270"
Title="$(loc.InstallDirDlg_Title)">
<Control Id="NextButton"
Type="PushButton"
X="236"
Y="243"
Width="56"
Height="17"
Default="yes"
Text="$(loc.WixUINext)">
<Publish Event="EndDialog"
Value="Return"><![CDATA[CustomTextA_NextArgs=""]]></Publish>
<Publish Event="NewDialog"
Value="[CustomTextA_NextArgs]"><![CDATA[CustomTextA_NextArgs<>""]]></Publish>
</Control>
....
</Dialog>
<InstallUISequence>
<Custom Action="CustomTextA_SetProperty_EDIT2"
After="CustomTextA_SetProperty_EDIT1" />
<Custom Action="CustomTextA_SetProperty_EDIT1"
After="ValidateProductID" />
<Custom Action="CustomTextA_SetProperty_EDIT3"
After="CustomTextA_SetProperty_EDIT2" />
<Custom Action="CustomTextA_SetProperty_EDIT4"
After="CustomTextA_SetProperty_EDIT3" />
<Custom Action="ERRCA_UIANDADVERTISED"
Before="AppSearch"><![CDATA[ProductState=1]]></Custom>
<Show Dialog="CustomTextA"
OnExit="success" />
</InstallUISequence>
<AdminUISequence>
<Show Dialog="CustomTextA"
OnExit="success" />
</AdminUISequence>
</UI>
but CustomTextA dialog is not displayed when the installation finishes successfully, and standard ExitDialog is shown.
What can be wrong in the code?
I am not sure what the customs actions like Custom Action="CustomTextA_SetProperty_EDIT2" for, but I left them to provide the code as it is.
Wix version is 3.11 (Probably something went wrong after upgrading from an earlier Wix version).
Summary: Please try to download the sample below and have a look at it in Visual Studio. Also read the step-by-step description below for how to use it as a template. I would gather all GUI-markup inside the WixUI_MyMondo.wxs file. Be sure to skim the previous answers linked too.
WiX Custom Dialog Sample: I have a WiX custom GUI sample here (just click download). It is a "Hello WiX" kind of thing - intended to be as simple as possible, but no simpler. In other words it is just doing a couple of things.
It copies the standard WiX dialog source markup in the file WixUI_Mondo.wxs and calls the new file WixUI_MyMondo.wxs. It is put next to Product.wxs.
The main Product.wxs file then includes the customized version with <UIRef Id="WixUI_MyMondo" /> (instead of the standard <UIRef Id="WixUI_Mondo" />) allowing the WixUI_MyMondo.wxs file to be changed as desired.
The rest of the dialogs are linked from the WixUIExtension.dll file (as normal).
I always keep all the dialog events and configurations inside WixUI_MyMondo.wxs - meaning that I try to avoid dialog constructs inside Product.wxs.
Please download and check the sample. It is impossible - as far as I can tell - to deduce more from the markup you have provided.
Previous Answers: Here are two previous answers on the issue of WiX GUI. Rather than rewriting the content in a way that could miss your real question, please skim them will you?
General information on Custom WiX / MSI GUI
Changing dialog order
Links: Some further links here on setup GUI. Burn is WiX's setup.exe generator. It can have its own GUI separate from that embedded in MSI files.
Burn: WiX's bootstapper setup.exe generator: WIX Installer with modern look and feel
More on Burn: Removing Default dialogs from MSI
I am using the WIX default BrowseDlg to capture a value to insert into the web.config file. I am using code that I have seen in numerous places now.
<Control Id="btnDirBrowse" Type="PushButton" Width="56" Height="17" X="260" Y="57"
Text="!(loc.DataDialog.BrowseCaption)" >
<Publish Property="_BrowseProperty" Value="DATALOCATION" Order="1">1</Publish>
<Publish Event="SpawnDialog" Value="BrowseDlg" Order="2">1</Publish>
</Control>
The problem I have is that when I click ok after navigating to a file location, I get error 2727:
The directory entry '[2]' does not exist in the Directory table.
The value I am getting represents the location of data files that have already been installed on the system. This location has nothing to do with the installer other than being a string value to write to web.config. If I don't use BrowseDlg and just enter a string in the textbox of my custom dialog, everything works fine, but if I use BrowseDlg, I get this error.
The location of the existing data files could be anywhere on the network, so I have no idea how to establish a reference in the Directory table.
What can I do to make BrowseDlg happy?
I just wanted to provide an fix that worked for me. I was having the same issue but with the default directory browser in wix.
My problem was that my "WIXUI_INSTALLDIR" property was something other than "TARGETDIR". Essentially, from what I'm guessing the "Directory table" must reference a directory created by a Directory tag.
For example:
<Directory Id="TARGETDIR" Name="SourceDir">
The below fixed my issue
<Property Id="WIXUI_INSTALLDIR" Value="TARGETDIR" />
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.
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.
I have created a custom action that gets triggered via UI. It works fine for new install but fails during upgrade. However, if I run a repair from control panel, it then runs fine. I tried capturing msi log but it does not give any clue. Here are the snippets...
UI:
<Control Id="CloseButton" Type="PushButton" X="230" Y="243" Width="66" Height="17" Default="yes" Cancel="yes" Text="&Continue">
<Publish Event="DoAction" Value="ConfigureServer1">1</Publish>
<Publish Event="EndDialog" Value="Return">1</Publish>
</Control>
Custom Action:
<CustomAction Id="ConfigureServer1" Impersonate="no" Directory="TARGETDIR" Return="asyncNoWait" ExeCommand="[#fileSetupDb] "[ProductVersion]" "[OCISUPGRADE]""></CustomAction>
Sequence for the UI file:
<InstallUISequence>
......
<Show Dialog="FinishedForm" OnExit="success" />
......
</InstallUISequence>
Any clues.... or anything I can try to debug etc.? I tried for a couple of days with no results. I am not a newbie in msi or wix and not an expert either.
I don't completely follow the question but I'll take a guess. When upgrading the "previous version of the product" (the MSI being removed) only has its InstallExecuteSequence run. So the custom action in the old version of the product in the InstallUISequence won't run.
If the question is why the custom action won't run in the new version of the product, then there isn't enough information here. You can look in the verbose log file to see what the result of the custom action with the matching Id.