I am using WIX 3.8 and have a Burn project that installs an MSI.
I have a string variable in the Burn project that has a default value that is passed to the MSI. I want to allow the user to edit this at install time but can't get it to work. How do you allow a user to edit a Burn string variable?
My current code is as below. The EditBox is shown but the default value is not displayed and the value entered is not passed to the MSI.
Bundle.wxs
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" xmlns:netfx="http://schemas.microsoft.com/wix/NetFxExtension" xmlns:bal="http://schemas.microsoft.com/wix/BalExtension">
<Bundle Name="My Bundle"
Version="!(bind.packageVersion.Installer)"
Manufacturer="!(bind.packageManufacturer.Installer)"
UpgradeCode="e71d08e2-0083-483d-acfb-4bf9adfd08b0">
<BootstrapperApplicationRef Id="WixStandardBootstrapperApplication.HyperlinkLargeLicense">
<bal:WixStandardBootstrapperApplication ShowVersion="yes" LicenseUrl="" LogoFile="logo_64x64.jpg" ThemeFile="Theme.xml" />
</BootstrapperApplicationRef>
<Variable Name="ADDRESS" bal:Overridable="yes" Type="string" Value="https://my.server.com" />
<Chain>
<MsiPackage Id="Installer" SourceFile="$(var.Installer.TargetPath)">
<MsiProperty Name="ADDRESS" Value="[ADDRESS]" />
</MsiPackage>
</Chain>
</Bundle>
</Wix>
Theme.xml:
...
<Page Name="Options">
<Text X="11" Y="80" Width="-11" Height="30" FontId="2" DisablePrefix="yes">#(loc.OptionsHeader)</Text>
<Editbox Name="ADDRESS" X="11" Y ="120" Width="100" Height="21" TabStop="yes" FontId="3" />
<Button Name="OptionsOkButton" X="-91" Y="-11" Width="75" Height="23" TabStop="yes" FontId="0">#(loc.OptionsOkButton)</Button>
<Button Name="OptionsCancelButton" X="-11" Y="-11" Width="75" Height="23" TabStop="yes" FontId="0">#(loc.OptionsCancelButton)</Button>
</Page>
...
Hope you've already found an answer to this question, if not, here's my stab at it.
It looks like your EditBox element is just missing the ADDRESS property reference. e.g.:
<Editbox Name="ADDRESS" X="11" Y ="120" Width="100" Height="21" TabStop="yes" FontId="3" >[ADDRESS]</EditBox>
Hope this helps!
Related
In the default Wix Theme I see
<Page Name="Install">
<Text Name="InstallVersion" X="11" Y="-41" Width="210" Height="17" FontId="3" DisablePrefix="yes" HideWhenDisabled="yes">#(loc.InstallVersion)</Text>
<Checkbox Name="EulaAcceptCheckbox" X="-11" Y="-41" Width="260" Height="17" TabStop="yes" FontId="3" HideWhenDisabled="yes">#(loc.InstallAcceptCheckbox)</Checkbox>
<Button Name="OptionsButton" X="-171" Y="-11" Width="75" Height="23" TabStop="yes" FontId="0" HideWhenDisabled="yes">#(loc.InstallOptionsButton)</Button>
<Button Name="InstallButton" X="-91" Y="-11" Width="75" Height="23" TabStop="yes" FontId="0">#(loc.InstallInstallButton)</Button>
<Button Name="WelcomeCancelButton" X="-11" Y="-11" Width="75" Height="23" TabStop="yes" FontId="0">#(loc.InstallCloseButton)</Button>
</Page>
What does the #(loc.name) stuff refer to? I'm assuming it's a variable, but where are they set?
I have my own TextBox on the Options page which I default to a particular value, but whenever you go back to the page, any previously entered value will revert to the default.
I'm assuming this wouldn't happen if the TextBox value was that of a variable - whatever the user entered would be stored in the variable, and they'd see that value if they exited the Options page and returned to it.
I could then initialise this variable to the value I wanted.
Does anybody know how to do this?
The #(loc.variable) stuff is to do with localisation. You can find the defaults in your WiX Toolset SDK/themes folder under HyperlinkTheme.xml.
In regards to having the entered value save between page changes, putting a variable under you works, as long as its name is the same as your WiX Theme UI element:
<Variable Name="TestVariable" Type="numeric" Value="8443" />
I have created a sample custom burn application (BA) using Wix. When the BA runs we want to not install anything and exit if a secret code is not entered correctly. I copied over the standard theme and changed the Install page as shown below to add an editbox with Name=SecretCode, and added a variable to the Bundle to receive SecretCode. When the BA runs the user enters the secret code and the code shows up in the log and InstallCondition evaluates to false, but the msi is still installed. In the ExePackage documentation the InstallCondition states:
"The package will only be installed if the condition evaluates to true. If the condition evaluates to false and the bundle is being installed, repaired, or modified, the package will be uninstalled."
In my case the BA is installing, and even though the secret code does not match the msi is still installed. I cannot pass in command line args, and would like to stay away from a custom managed application. This is a simplified example to demonstrate our problem.
Is there a way to get this working or something I am doing wrong?
Log
[1FE4:12AC][2016-04-08T15:07:01]i000: Setting string variable 'SecretCode' to value 'boo'
[1FE4:230C][2016-04-08T15:07:01]i052: Condition 'SecretCode=foo' evaluates to false.
[1FE4:230C][2016-04-08T15:07:01]w321: Skipping dependency registration on package with no dependency providers: Netfx46Full
[1FE4:230C][2016-04-08T15:07:01]i052: Condition 'SecretCode=foo' evaluates to false.
[1FE4:230C][2016-04-08T15:07:01]i201: Planned package: MySetup, state: Absent, default requested: Absent, ba requested: Absent, execute: None, rollback: None, cache: No, uncache: No, dependency: None
Install Page
<Page Name="Install">
<!--
<Richedit Name="EulaRichedit" X="11" Y="80" Width="-11" Height="-70" TabStop="yes" FontId="0" HexStyle="0x800000" />
<Checkbox Name="EulaAcceptCheckbox" X="-11" Y="-41" Width="260" Height="17" TabStop="yes" FontId="3" HideWhenDisabled="yes">#(loc.InstallAcceptCheckbox)</Checkbox>
-->
<Text Name="SomeText" X="60" Y="50" Width="-11" Height="-70" TabStop="no" FontId="0" >
<![CDATA[
Please enter the secret code in the following field.
]]>
</Text>
<Editbox Name="SecretCode" X="85" Y="150" Width="-91" Height="21" TabStop="yes" FontId="3" FileSystemAutoComplete="no" />
<Button Name="OptionsButton" X="-171" Y="-11" Width="75" Height="23" TabStop="yes" FontId="0" HideWhenDisabled="yes">#(loc.InstallOptionsButton)</Button>
<Button Name="InstallButton" X="-91" Y="-11" Width="75" Height="23" TabStop="yes" FontId="0">#(loc.InstallInstallButton)</Button>
<Button Name="WelcomeCancelButton" X="-11" Y="-11" Width="75" Height="23" TabStop="yes" FontId="0">#(loc.InstallCloseButton)</Button>
</Page>
Bundle.wxs
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
xmlns:bal="http://schemas.microsoft.com/wix/BalExtension"
xmlns:util="http://schemas.microsoft.com/wix/UtilExtension"
xmlns:netfx="http://schemas.microsoft.com/wix/NetFxExtension" >
<Bundle Name="My Bootstrapper" Version="8.0.0.682" Manufacturer="FooBar" UpgradeCode="33AAE528-A1F0-45DD-AAF5-A83B4B749F10">
<WixVariable Id="WixStdbaThemeXml" Value="Themes\ExtractionTheme.xml" />
<Variable Name="SecretCode" bal:Overridable="yes"/>
<BootstrapperApplicationRef Id="WixStandardBootstrapperApplication.HyperlinkLicense" >
<bal:WixStandardBootstrapperApplication SuppressOptionsUI="yes" LicenseUrl="" LogoFile="graphics\logo.png" LogoSideFile="graphics\logoSide.png" />
</BootstrapperApplicationRef>
<Chain>
<MsiPackage
Id="MySetup"
Cache="no" Compressed="yes" DisplayInternalUI="yes"
InstallCondition="SecretCode=foo"
SourceFile="SetupFiles\MyInstaller.msi" />
</Chain>
</Bundle>
</Wix>
In my installer I want user to connect to database. I support 4 database types in my product.
In the connect to database dialog I created, there is a ComboBox control with all supported database types, Edit control where user suppose to enter the connection string and a PushButton, when pressed it will show connection string text template in Edit control according to selected database type in ComboBox. Now, the problem is:
User clicks Show Template button when MSSQL is selected
User alters manually place holder in text template connection string in Edit
control
User realize that he needs MySQL connection
User change value in ComboBox to MySQL and clicks Show Template button and nothing
happens.
To summarize this, after Edit control were manually altered, the Show Template stops working.
Here is WiX code use:
<Fragment>
<!-- Supported databases templates -->
<Property Id="MSSQLTemplate" Value="Data Source=localhost;Initial Catalog=[database];Integrated Security=yes"/>
<Property Id="MySQLTemplate" Value="Server=localhost;Uid=[username];Pwd=[password];Database=[database];" />
<Property Id="DB2Template" Value="Server=localhost;Uid=[username];Pwd=[password];Database=[database];" />
<Property Id="OracleTemplate" Value="Data Source=[database];User Id=[username];Password=[password];" />
<Property Id="PROP_DATABASE_TYPE">MSSQL</Property>
<Property Id="PROP_CONNECTIONSTRING"></Property>
<Binary Id="CA_DLL" SourceFile="$(var.CustomActions.TargetDir)CustomActions.CA.dll" />
<CustomAction Id="caShowTemplate" BinaryKey="CA_DLL" DllEntry="ShowTemplate" Execute="immediate" />
<UI Id="InstallDlg_UI">
<TextStyle Id="Tahoma_Regular" FaceName="Tahoma" Size="8" />
<Property Id="DefaultUIFont" Value="Tahoma_Regular" />
<Dialog Id="InstallDlg" Width="370" Height="270" Title="Amazing Software" NoMinimize="no">
<!-- Database type -->
<Control Id="lblDatabaseType" Type="Text" X="20" Width="100" Y="60" Height="18" NoPrefix="yes" Text="Database Type" />
<Control Id="cbDatabaseServer" Type="ComboBox" X="120" Width="90" Y="60" Height="18" Property="PROP_DATABASE_TYPE" ComboList="yes" Sorted="yes">
<ComboBox Property="PROP_DATABASE_TYPE">
<ListItem Text="MSSQL" Value="MSSQL" />
<ListItem Text="MySQL" Value="MySQL" />
<ListItem Text="Oracle" Value="Oracle" />
<ListItem Text="DB2" Value="DB2" />
</ComboBox>
</Control>
<Control Id="btnShowTemplate" Type="PushButton" X="215" Y="60" Width="85" Height="17" Text="Show Template">
<Publish Event="DoAction" Value="caShowTemplate" Order="1">1</Publish>
<Publish Property="PROP_CONNECTIONSTRING" Value="[PROP_CONNECTIONSTRING]" Order="2">1</Publish>
</Control>
<!-- Connection string -->
<Control Id="lblConnectionString" Type="Text" X="20" Width="100" Y="85" Height="18" NoPrefix="yes" Text="Connection String" />
<Control Id="tbConnectionString" Type="Edit" X="120" Width="180" Y="85" Height="18" Property="PROP_CONNECTIONSTRING" Text="[PROP_CONNECTIONSTRING]" />
<Control Id="CancelButton" Type="PushButton" Text="Cancel" Height="17" Width="56" X="180" Y="243" Cancel="yes">
<Publish Event="EndDialog" Value="Exit" />
</Control>
</Dialog>
<InstallUISequence>
<Show Dialog="InstallDlg" Before="ExecuteAction" />
</InstallUISequence>
</UI>
</Fragment>
And a custom action written in C#:
[CustomAction]
public static ActionResult ShowTemplate(Session session)
{
string selectedDatabase = string.Format("{0}Template", session["PROP_DATABASE_TYPE"]);
session["PROP_CONNECTIONSTRING"] = session[selectedDatabase];
return ActionResult.Success;
}
What am I doing wrong?
Your code doesn’t have any issue. It is a well-known limitation of WIX UI. Check the below discussions for more details.
http://windows-installer-xml-wix-toolset.687559.n2.nabble.com/UI-Edit-Box-not-updating-td5077648.html
Wix Interactions with Conditions, Properties & Custom Actions
I have created a WiX Bootstrapper project. When the installation runs, it presents a license agreement.
I want to create a bootstrapper without this step as I don't want it to show any license agreement. Is it possible to do it? If yes, how?
Assuming that you are using the WiX Standard Bootstrapper Application, your current BootstrapperApplicationRef might look like this:
<BootstrapperApplicationRef Id="WixStandardBootstrapperApplication.RtfLicense" />
WixStandardBootstrapperApplication has three variants as explained in the docs. HyperlinkLicense is the simplest. It has a license link on the welcome page instead of a license page. It allows you to specify an empty URL for the license, in which case it won't display the link. For example,
<BootstrapperApplicationRef Id="WixStandardBootstrapperApplication.HyperlinkLicense">
<bal:WixStandardBootstrapperApplication
LicenseUrl=""
xmlns:bal="http://schemas.microsoft.com/wix/BalExtension" />
</BootstrapperApplicationRef>
I used a custom theme to get rid of the license agreement step. You can see a brief overview of how to do that here.
Steps to take:
Download the WiX 3.11 source, which you can download here at the bottom of the page.
Extract it to a folder and add HyperlinkTheme.xml and HyperlinkTheme.wxl to your bootstrapper project. The files can be found at \src\ext\BalExtension\wixstdba\Resources relative to where they were extracted.
Add the BalExtension namespace definition to the Wix element in your bundle file:
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
xmlns:bal="http://schemas.microsoft.com/wix/BalExtension">
Modify your bootstrapper definition to something like this:
<BootstrapperApplicationRef Id="WixStandardBootstrapperApplication.HyperlinkLicense">
<bal:WixStandardBootstrapperApplication
LicenseUrl=""
ThemeFile="HyperlinkTheme.xml"
LocalizationFile="HyperlinkTheme.wxl"
SuppressOptionsUI="yes" />
</BootstrapperApplicationRef>
Now open the theme file and change the page with the Name attribute set to Install and comment out or remove the checkbox and hyperlink:
<Page Name="Install">
<!--<Hypertext Name="EulaHyperlink" X="11" Y="121" Width="-11" Height="51" TabStop="yes" FontId="3" HideWhenDisabled="yes">#(loc.InstallLicenseLinkText)</Hypertext>
<Checkbox Name="EulaAcceptCheckbox" X="-11" Y="-41" Width="260" Height="17" TabStop="yes" FontId="3" HideWhenDisabled="yes">#(loc.InstallAcceptCheckbox)</Checkbox>-->
<Button Name="OptionsButton" X="-171" Y="-11" Width="75" Height="23" TabStop="yes" FontId="0" HideWhenDisabled="yes">#(loc.InstallOptionsButton)</Button>
<Button Name="InstallButton" X="-91" Y="-11" Width="75" Height="23" TabStop="yes" FontId="0">#(loc.InstallInstallButton)</Button>
<Button Name="WelcomeCancelButton" X="-11" Y="-11" Width="75" Height="23" TabStop="yes" FontId="0">#(loc.InstallCloseButton)</Button>
</Page>
After doing that your bootstrapper should now look like:
I personally would change the theme more so it doesn't look so awkward with all of that blank space.
We are trying to roll out authentication into my app and it’s not working for us.
We have set up the Current Authority and Current Authorizer and have even set the login query to be just select ‘a’ so we are guaranteed to get a result set.
We have copied the Login workflow to workflows/system directory.
It doesn’t look like it’s even trying to run the login query.
start.xml workflow:
<workflow>
<authenticate error-screen="login-error" dataset="login">
<show-screen name="login" />
</authenticate>
<call-workflow name="home"/>
</workflow>
login.xml screen:
<screen xmlns:action="urn:aviarc:widget:com.aviarc.toronto.widget.core.action:1"
xmlns:app="urn:aviarc:widget:application">
<group-box visible="y" left="10" right="4" top="10" bottom="4" class="blue">
<image height="80" width="245" left="10" top="5" class="mfcologo" />
<line height="5" left="0" right="0" top="120" class="myerblue" />
<text-static visible="y" left="74" top="151" width="80" height="20" text="User name:" />
<text-static visible="y" left="234" top="151" width="80" height="20" text="Password:" />
<text-edit name="username" left="74" top="182" width="100" height="20" field="login.user_name" />
<text-edit name="password" left="234" top="182" width="100" height="20" field="login.user_password" datatype="password" />
<button left="376" top="182" width="60" height="20" label="Login" action="Next"/>
</group-box>
</screen>
system/Login.xml workflow:
<workflow xmlns:au-security="urn:aviarc:xmlcommand:au.com.aviarc.xmlcommand.security">
<au-security:hash-text text="{$login.user_password}" result-field="login.hashed-password" />
<dataset name="cslogin" databroker="loginqry" query="get-all">
<param name="username" value="{$login.user_name}" />
<param name="password" value="{$login.hashed-password}" />
</dataset>
<if test="dataset-empty" value1="cslogin">
<then>
<set-field field="login.authenticated" value="n"/>
</then>
<else>
<set-field field="login.authenticated" value="y"/>
</else>
</if>
</workflow>
The Workflow authentication requires "username" field to be populated prior to entering it, otherwise the authentication would fail immediately and login error screen will be displayed.
In your example it is fairly easy to fix, changing the line in login.xml screen from:
<text-edit name="username" left="74" top="182" width="100" height="20" field="login.user_name" />
to be:
<text-edit name="username" left="74" top="182" width="100" height="20" field="login.username" />
and updating reference to it in the system/Login workflow.