What is the WiX 'KeyPath' attribute? In particular, how does it apply to the following:
<Component Id="ProgramMenuDir" Guid="*">
<RemoveFolder Id="ProgramMenuDir" On="uninstall" />
<RegistryValue Root="HKCU" Key="Software\CompName\AppName"
Type="string" Value="" KeyPath="yes" />
</Component>
As explained by Rob Mensching:
The KeyPath for a Component is a
single resource that the Windows
Installer uses to determine if a
Component "exists" on a machine.
This means that when Windows Installer decides whether to install your component, it will first look whether the keypath resource is already present. If it is, none of the resources in the component are installed.
The presence of the keypath resource also determines whether a component has been damaged or has gone missing when you "repair" an MSI.
When the keypath resource is a versioned file, Windows Installer will consider it to exist only if it finds a file with an equal or higher version.
In your specific example, you have a component which removes a folder on uninstallation. This component will only be installed if the given registry key does not yet exists. Adding a registry key to use as the key path is a common trick when you need a keypath for a component that installs resources that cannot be used as a keypath themselves, like a shortcut.
Related
I need to create a download URL in wix burn based on the user inputs to download a MSI package. I am setting the properties as below and properties set into those variable without a problem when I give them as inputs while creating the .exe package.
<Variable Name="PROTOCOL" Value="!(wix.Protocol)" bal:Overridable="yes"/>
<Variable Name="SOURCE" Value="!(wix.Source)" bal:Overridable="yes"/>
But the problem is when I use these properties inside the downloadUrl attribute of the MsiPackage element actual values of the properties will not be taken. Burn just recognize them as [PROTOCOL] and [SOURCE]. Following is my MsiPackage element.
<MsiPackage Id="SSCE" Name="SQL Server Compact Edition" SourceFile="../PackageRepo/SQLCE 3.5/SSCERuntime-ENU.msi" Cache="no" Vital="yes" Compressed="no" ForcePerMachine="yes" Permanent="yes"
DownloadUrl="[PROTOCOL]://[SOURCE]/PackageRepo/SQLCE 3.5/SSCERuntime-ENU.msi" InstallCondition="(NOT SSCERuntimeVersion) AND (NOT SSCERuntimeServicePackLevel)"/>
Because of this file is not downloading.
So can anyone please tell me how to use the property values inside the MsiPackage element's downloadUrl attribute.
I'm trying to disable registry reflection in WiX.
Because I want to write in Key="Software\\[Manufacturer]\\[ProductName]", regardless of platform. When I install my app on x64 platform, installer replace key "Software\Wow6432Node\\[Manufacturer]\\[ProductName]"
When I set DisableRegistryReflection="yes" attribute, installer still write to "Software\Wow6432Node\\[Manufacturer]\\[ProductName]".
<Component DisableRegistryReflection="yes" Id="SampleID">
<RegistryKey Root="HKLM" Key="Software\[Manufacturer]\[Product Name]" Action="createAndRemoveOnUninstall">
<RegistryValue Type="string" Value="[UpdaterLocation]" Name="RootFolder"/>
</RegistryKey>
</Component>
To write in that portion of the registry you must mark you component as 64-bit Win64="yes"
It's imposible, becouse I have clearly 32 bit component.
I have seen How do you create an event log source using WiX. My question is what is the common use (scenario) of specifying Event Source in Wix? I was thinking that specifying the source would list your application's install/uninstall process under that source in the event log so it would be easy to filter/check but even after doing that the source shows up as MsiInstaller for me. What am I doing wrong or am I misunderstanding the use of util:EventSource?
Here is my code :
<Component Id="EventLogSettings" Guid="A456420B-21E7-4306-904E-5CD3822193F0">
<util:EventSource Log="Application" Name="WixSample" SupportsErrors ="yes" SupportsInformationals ="yes" SupportsWarnings ="yes" EventMessageFile="%SystemRoot%\Microsoft.NET\Framework\v2.0.50727\EventLogMessages.dll" KeyPath="yes"/>
<!--<?if $(var.Platform) = x64 ?>
<util:EventSource Log="Application" Name="WixSample" EventMessageFile="[NETFRAMEWORK20INSTALLROOTDIR64]EventLogMessages.dll" KeyPath="yes" />
<?else ?>
<util:EventSource Log="Application" Name="WixSample" EventMessageFile="[NETFRAMEWORK20INSTALLROOTDIR]EventLogMessages.dll" KeyPath="yes" />
<?endif ?>-->
</Component>
As you can see I tried two options. Each of them creates a registry entry in the Computer\HKLM\SYSTEM\CurrentControlSet\services\eventlog\Application\WixSample but I am not sure if I need to reference the WixNetFxExtension. If I do then what about installation of non .net application? What do I do in those cases?
You are misunderstanding EventSource. EventSource is used to create a custom source for your application to use in it's logging to the windows event log.
You will always see the install/uninstall of your application show up as MsiInstaller.
I have a WiX installer which has 3 Projects. 2 Creates Merge Moduels, 1 Creates the installer. The code in the mergemodules should only be executed if the corresponding feature is selected. Is there any chance to get this to work with custom actions?
From my experience the custom actions are always called - wether or not a certain feature is selected...
Code in the Podoct:
<Feature Id="Complete" Title="SDK Setup" Description="Installs the sdk" Display="expand" Level="1" ConfigurableDirectory="INSTALLLOCATION">
<Feature Id="SDK" Title ="SDK" Description="" Level ="1">
....
In the Merge Module I call some custom actions, e.g.:
<CustomAction Id='CustomAction' BinaryKey='CaDll' DllEntry='CaEntry' Execute='deferred' />
<CustomAction Id="CustomAction.SetProperty" Return="check" Property="CustomAction" Value='test' Execute='immediate' />
<InstallExecuteSequence>
<Custom Action='CustomAction.SetProperty' After='CostFinalize'>(NOT Installed) AND (NOT UPGRADINGPRODUCTCODE) </Custom>
<Custom Action='CustomAction' After='InstallFiles'>(NOT Installed) AND (NOT UPGRADINGPRODUCTCODE) </Custom>
Custom actions in general are not tied to components or features. From one perspective this is because they should be written in a data-driven fashion: inspect the install and action states of all components in your code to build up a list of actions to take.
But when actions don't make sense that way (even with the help of a custom database table), you can always tie them to the action state of the feature or component by their condition. See Conditional Statement Syntax for "Access Prefixes" or "Feature and Component State Values", and in particular the examples near the bottom: &MyFeature=3 is true when MyFeature is being installed.
I'm using WiX to create an installer for a windows service. It's desirable that the name of service that gets installed and displayed in Services is configurable at install time.
For example, this is what I'm thinking (wix xml snip):
<ServiceInstall
Id="MyServiceInstaller"
Name="NAME_PASSED_FROM_DIALOG"
Type="ownProcess"
Start="auto"
ErrorControl="normal"
Description="My Service"
Account="localsystem"/>
<ServiceControl
Id="StartMyServiceInstaller"
Name="NAME_PASSED_FROM_DIALOG"
Start="install"
Wait="no" />
<ServiceControl
Id="StopMyServiceInstaller"
Name="NAME_PASSED_FROM_DIALOG"
Remove="uninstall"
Stop="both"
Wait="yes" />
NAME_PASSED_FROM_DIALOG is something I would like to hook up to a custom dialog that gets created and gets displayed to the person installing the service so they can set/modify the service name. I think this is very similar to the WIXUI_INSTALLDIR property that gets set and passed to the WixUI_InstallDir Dialog Set.
My question is:
How do I create a custom UI dialog that can accept user input which gets passed into runtime of the installer?
Have fun with UI!
Edit: The original link to answer doesn't exist anymore. FireGiant (the maintainers of Wix) some examples for part of this process, but it's doesn't completely answer this question. There is one further tutorial (UPDATE Aug.2018: Link resurrected from Wayback Machine) that does go most of the way to answer this question.
A high level overview of what will be happening is:
Create a property
Have the UI control set this property
The name attribute on the service will reference the property, ie [ServiceNameProperty].
However this is complex, and the way that is suggested to create a new UI dialog, is to take an existing dialog, make a clone of it, and then edit with new text, controls and use it to populate the property.
Try to use
WixEdit
that is nice tool for creating UI