What do you put in RegistrySpec.xml for Izpack installation to set Size field - izpack

This is my xml file for installer.
<izpack:registry version="5.0"
xmlns:izpack="http://izpack.org/schema/registry"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://izpack.org/schema/registry http://izpack.org/schema/5.0/izpack-registry-5.0.xsd">
<pack name="UninstallStuff">
<!-- Special "pack", if not defined an uninstall key will be generated automatically -->
<!-- The variable $UNINSTALL_NAME can be only used if CheckedHelloPanel will be used
because there the variable will be declared. With that variabel it is possible
to install more as one instances of the product on one machine each with an
unique uninstall key. -->
<value name="DisplayName"
keypath="SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$APP_NAME $APP_VER"
root="HKLM"
string="$APP_NAME" />
<value name="DisplayVersion"
keypath="SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$APP_NAME $APP_VER"
root="HKLM"
string="$APP_VER" />
<value name="UninstallString"
keypath="SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$APP_NAME $APP_VER"
root="HKLM"
string=""$JAVA_HOME\bin\javaw.exe" -jar "$INSTALL_PATH\uninstaller\uninstaller.jar"" />
<value name="DisplayIcon"
keypath="SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$APP_NAME $APP_VER"
root="HKLM"
string="$INSTALL_PATH\icon\uninstallericon.ico" />
<value name="Publisher"
keypath="SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$APP_NAME $APP_VER"
root="HKLM"
string="opname" />
</pack>
</izpack:registry>
I am getting publisher name but i am not able to get size field value.How can i add size field in add remove program.

I guess you've probably found the solution by now (or given up) as this question is over three years old, but I have found the solution. It doesn't seem to be documented on the IzPack site, but digging through the schema and the registry settings of other installed programs reveals the answer.
Application size is stored in the registry as a 32-bit DWORD value, which is the application's size in KB, under the key "EstimatedSize". For example, for a 100MB (==102400KB) application, your configuration would look like the following:
<value name="EstimatedSize"
keypath="SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$APP_NAME $APP_VER"
root="HKLM"
dword="102400" />

Related

Is it possible to set the values of my Wix Burn gui with a registry search?

My WIX bootstrapper has various optional parameters as well as some settings the user sets up, such as the install location. I want these settings in the GUI to default to the previous values entered by the user when they go to the options screen of the Boostrapper. I have attempted to do this with a util:RegistrySearch of those settings (which are written by the MSI), but they do not appear to be reading in. Is there a way to do this?
These variables are the ones I am attempting to read the registry values into (each one corresponds to a GUI element in the Theme:
<Variable Name="txtCustCode" bal:Overridable="yes" Type="string" Value=""/> <!--CUSTCODE-->
<Variable Name="txtServer" bal:Overridable="yes" Type="string" Value=""/> <!--SERVER-->
<Variable Name="txtDatabase" bal:Overridable="yes" Type="string" Value=""/> <!--DBNAME-->
These are the registry searches with which I am trying to read the values into the variables/controls
<util:RegistrySearch Id="CustCode" Variable="txtCustCode" Root="HKLM" Key="SOFTWARE\[Manufacturer]\[ProductName]" Value="CustCode" Win64="no" Format="raw" Result="value" />
<util:RegistrySearch Id="Server" Variable="txtServer" Root="HKLM" Key="SOFTWARE\[Manufacturer]\[ProductName]\Server" Win64="no" Format="raw" Result="value"/>
<util:RegistrySearch Id="Database" Variable="txtDatabase" Root="HKLM" Key="SOFTWARE\[Manufacturer]\[ProductName]\Database" Win64="no" Format="raw" Result="value" />

Is it possible to read from 64 and 32-bit registry entries in the same installation?

In my installation I need to check presence of 64-bit entry at first.
And read its value if it is present in 64-bit part of registry.
If entry is absent then I need to try to read this entry from 32-bit registry part(Wow6432Node).
I need to read it directly from wxs file or from custom action on VBScript.
Is it possible to do?
If you're running a 64bit MSI you can set two AppSearch/RegLocator entries using the style:
<Property Id="MY_32BIT_REG">
<RegistrySearch Id="my32bitreg"
Root="HKLM"
Key="SOFTWARE\My Company"
Name="foo"
Type="raw"
Win64="no" />
</Property>
<Property Id="MY_64BIT_REG">
<RegistrySearch Id="my64bitreg"
Root="HKLM"
Key="SOFTWARE\My Company"
Name="foo"
Type="raw"
Win64="yes" />
</Property>
These entries will check the appropriate "HKLM\SOFTWARE\My Company" and "HKLM\SOFTWARE\Wow6432Node\My Company" registry hives.

util:RegistrySearch "Registry key not found" when using variable inside Win64="$(var.Win64)"

<util:RegistrySearch does not find registry keys when using a variable for yes/no for example: Win64="$(var.Win64)".
It works as expected if I use the string yes/no instead of the variable for example: Win64="yes".
The var.Win64 is set to yes/no via a build script which prompts us for which OS to build for. The logs show it is being set to yes properly before DetectBegin.
<!-- Variables.wxi: -->
<?define Win64 = "yes" ?>
<!-- Product.wxs -->
<?xml version="1.0" encoding="UTF-8"?>
<?include ..\Setup\Variables.wxi ?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
<Fragment>
<Variable Name="MyAppVersion" Type="version" Value="$(var.ProductVersion)" />
<Variable Name="RegMyAppVersion" Type="version" Value="0.0.0.0" />
<Variable Name="Win64Version" Type="string" Value="$(var.Win64)" />
<util:RegistrySearch Root="HKLM" Key="SOFTWARE\$(var.Manufacturer)\$(var.ProductName)"
Result="exists"
Value="Version"
Variable="RegMyAppExists"
Win64="$(var.Win64)"/>
<util:RegistrySearch Root="HKLM" Key="SOFTWARE\$(var.Manufacturer)\$(var.ProductName)"
Result="value"
Value="Version"
Variable="RegMyAppVersion"
Win64="$(var.Win64)"/>
<util:RegistrySearch Root="HKLM" Key="SOFTWARE\$(var.Manufacturer)\$(var.ProductName)"
Result="value"
Value="LicenseKey"
Variable="RegMyAppLicenseKey"
Win64="$(var.Win64)"/>
[0D30:2BAC][2014-03-21T08:32:03]i001: Burn v3.8.1021.0, Windows v6.1 (Build 7601: Service Pack 1)
[0D30:2BAC][2014-03-21T08:32:03]i000: Initializing version variable 'ROIPOSVersion' to value '1.9.26.0'
[0D30:2BAC][2014-03-21T08:32:03]i000: Initializing version variable 'RegROIPOSVersion' to value '0.0.0.0'
[0D30:2BAC][2014-03-21T08:32:03]i000: Initializing string variable 'Win64Version' to value 'yes'
[0D30:2BAC][2014-03-21T08:32:04]i000: Registry key not found. Key = 'SOFTWARE\MyMan\MyProd'
[0D30:2BAC][2014-03-21T08:32:04]i000: Registry key not found. Key = 'SOFTWARE\MyMan\MyProd'
[0D30:2BAC][2014-03-21T08:32:04]i000: Registry key not found. Key = 'SOFTWARE\MyMan\MyProd'
[0D30:2BAC][2014-03-21T08:32:04]i000: Setting numeric variable 'RegMyAppExists' to value 0
EDIT: I also get this warning in Visual Studio found in this post:
Warning 1 The 'Win64' attribute is invalid - The value '$(var.Win64)' is invalid according to its datatype 'http://schemas.microsoft.com/wix/2006/wi:YesNoType' - The '$' character, hexadecimal value 0x24, cannot be included in a name.
Also the "just remove Win64 altogether it will automatically figure it out" doesn't work on 64bit, still doesn't find the key.
I tried the suggestion again from here and just removed the Win64 attribute altogether.
It was able to find the registry key in 64bit now. I must have been mistaken before.

How to write production version to registry

I want to write the installed version to registry using WiX. Here is the WiX code of mine:
<Product Id="B20795DC-5462-4DE6-B629-8C034D114D3C" Name="ProductName" Language="1033" Version="1.1.3" Manufacturer="Corp" UpgradeCode="8f5c57ff-71fe-4fc6-9400-9bbbb76b4262">
....
<Component Id="ProgramRegistry">
<RegistryKey Id="RegInstallDir" Root="HKLM" Key="Software\[Manufacturer]\[ProductName]" Action="createAndRemoveOnUninstall">
<RegistryValue Type="string" Name="InstallVersion" Value="[Version]"/>
</RegistryKey>
</Component>
It creates a key named "InstallVersion" but the value is empty.
My question is how to write the product version into registry, the expected value should be the same as the version attribute in <Product> tag. (1.1.3)
The ProductVersion property contains the value you're looking for.
You can use ProductVersion property, the way #Stephen suggests. Alternatively, you can use the following approach:
define the version in a WiX variable
reference this variable in both Product element and RegistryValue element
set the product version in your build script and pass it to WiX compiler
Hence, your sample might look like this:
<Product Id="B20795DC-5462-4DE6-B629-8C034D114D3C" Name="ProductName" Language="1033" Version="$(var.Version)" Manufacturer="Corp" UpgradeCode="8f5c57ff-71fe-4fc6-9400-9bbbb76b4262">
....
<Component Id="ProgramRegistry">
<RegistryKey Id="RegInstallDir" Root="HKLM" Key="Software\[Manufacturer]\[ProductName]" Action="createAndRemoveOnUninstall">
<RegistryValue Type="string" Name="InstallVersion" Value="$(var.Version)"/>
</RegistryKey>
</Component>
</Product>
And somewhere in the build script (let's pretend, it is NAnt):
<candle out="${build.fodler}" rebuild="true" extensions="${build.extensions}" exedir="${wxs.dir}">
<defines>
...
<define name="Version" value="1.1.3" />
...
</defines>
<sources basedir="${paths.wxs}">
<include name="**.wxs"/>
</sources>
</candle>

Wix CopyFile only on target machine

I need to be able to copy a file that exists on the target machines hard-drive based on a registry setting that holds the folder path.
I have been trying to get this going for a day or two and am having difficulty, can anyone help?
Thanks,
B
Try something along these lines:
<Component Id="MyComponent" Guid="E5FF53DE-1739-42c4-BE37-60F810C9CD69">
<Condition>MYTESTDIR</Condition>
<CopyFile Id="fileToCopy.datCopy" SourceName="[MYTESTDIR]fileToCopy.dat" DestinationProperty="WEBSERVICEBINFOLDER" />
</Component>
You can populate MYTESTDIR with a value from the registry using a RegistrySearch.
You can first search your registry for the file as follows:
<Property Id="PROPERTYNAME" Secure="yes">
<RegistrySearch Id="SomeID"
Root="HKLM"
Type="raw"
Key="SOFTWARE\SomeFolder\SomeSubFolder"
Win64="yes"
Name="InstallPath">
<DirectorySearch Id="REQUIREDDIRECTORY" AssignToProperty="yes" Depth="1" Path="THEEXPECTEDPATH">
</DirectorySearch>
</RegistrySearch>
</Property>
Then use a Custom Action to set the file name
<CustomAction Id="SETFILE"
Property="FILE"
Value="[PROPERTYNAME]file.extension" />
and then copy file as described by the previous answer...
<CopyFile Id="fileToCopy.datCopy" SourceName="[FILE]" DestinationProperty="[YOURDESTINATION]" />