I'm new to WiX. I need to change the following registry-setting element:
<Component Id="BrowserEmulation" Directory="ApplicationProgramsFolder" Guid="*">
<RegistryValue Root="HKCU" Key="Software\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION" Name="MY_REG_ENTRY" Value="11000" Type="integer" KeyPath="yes"/>
</Component>
So that the registry entry gets installed under HKEY_LOCAL_MACHINE instead of HKEY_CURRENT_USER. I tried changing the Root value and the Key value:
<Component Id="BrowserEmulation" Directory="ApplicationProgramsFolder" Guid="*">
<RegistryValue Root="HKLM" Key="SOFTWARE\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION" Name="MY_REG_ENTRY" Value="11000" Type="integer" KeyPath="yes"/>
</Component>
I also tried removing the KeyPath component. But when I try to build the .msi I get the following error:
error LGHT0204: ICE38: Component Browser Emulation installs to user
profile. It's KeyPath registry key must fall under HKCU
I looked at the WiX docs that describe Component KeyPaths but wasn't able to figure out how to get around this.
Directory: Looks like you need to take out the Directory attribute from your component. Maybe try something like this:
<Component Feature="MainApplication">
<RegistryValue Root="HKLM" Key="SOFTWARE\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION" Name="MY_REG_ENTRY" Value="11000" Type="integer" KeyPath="yes"/>
</Component>
Bitness: Also be aware of the issue with 32-bit and 64-bit registry hives in HKLM: HKLM\SOFTWARE\WOW6432Node etc... Please see this answer for more details. I have inlined the most important part:
Registry:
64-Bit: HKEY_LOCAL_MACHINE\SOFTWARE
32-Bit: HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node
64-Bit: Maybe what you need is to mark your component as a 64-bit component? In order to write under HKEY_LOCAL_MACHINE\SOFTWARE?:
<Component Feature="MainApplication" Win64="yes">
<RegistryValue Root="HKLM" Key="SOFTWARE\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION" Name="MY_REG_ENTRY" Value="11000" Type="integer" KeyPath="yes"/>
</Component>
Related
Im using WIX 3.11.2 and when adding a registry key I get the following error:
“The Component/#Guid attribute's value '' is not valid for this component because it does not meet the criteria for having an automatically generated guid”*
I have created a ‘.wxs’ file which contains the following code that is failing:
<Fragment>
<ComponentGroup Id="myComponentGroup" Directory="TARGETDIR">
<Component Id="cmpRegUrlHandler" Guid="*">
<RegistryKey Root="HKCR" Key="HKEY_CLASSES_ROOT\myAppName\shell\open\command">
<RegistryValue Value="C:\Program Files\\myCompanyName\myProductName" KeyPath="yes" />
</RegistryKey>
</Component>
</ComponentGroup>
I run it using candel.exe/light.exe. However, light.exe gives me the above error.
Any help on this would be much appreciated.
You can't use Guid="*" for a component that has only a RegistryKey. You need to give it a real guid.
I need to insert a registry key in wix but the result is not important
how can I Ignore error.
sometimes because of permission reg creation fails
<Component Id="EXTEND_ADVANCE_TEXT_SERVICE" Guid="*">
<RegistryKey Root="HKLM" Key="SOFTWARE\Microsoft\CTF\SystemShared" Action="createAndRemoveOnUninstall">
<RegistryValue Type="integer" Name="CUAS" Value="1" KeyPath="yes"/>
</RegistryKey>
<Condition><![CDATA[VersionNT >= 501 AND VersionNT <= 502]]></Condition>
</Component>
The RegistryKey element does not have any error handling. Use a custom action and ignore the return code. There are plenty ways to do this, you can either author one in code or use a quiet execution custom action.
I am using the WiX Toolkit v3.11 for creating setups of my software. During installation I create startmenu shortcuts with the following code:
<Shortcut Id='startmenuMyProgram'
Name='$(var.MyProgramName)'
Directory='ProgramMenuFolder'
WorkingDirectory='APPLICATIONFOLDER'
Advertise='yes'
Icon='icon.exe'>
<Icon Id='icon.exe' SourceFile='$(var.Setuppath)\MyProgram.exe'/>
</Shortcut>
In this way I also create two shortcuts for other executables. Now for the uninstall I want to remove the shortcuts.
<Component Id="removeStartmenuShortcuts" Guid="803ad14a-feab-4901-b9db-2c4a1298ae8b">
<Condition>(REMOVE=ALL) AND NOT (WIX_UPGRADE_DETECTED OR UPGRADINGPRODUCTCODE)</Condition>
<RemoveFile Id="remove_startmenuProgram1" Name="startmenuMyProgram" On="uninstall" />
<RemoveFile Id="remove_startmenuProgram2" Name="startmenuMyProgram2" On="uninstall"/>
<RemoveFile Id="remove_startmenuProgram3" Name="startmenuMyProgram3" On="uninstall"/>
</Component>
This works without any problems when I uninstall the software. But the shortcuts are also removed when an update is performed. But I want to prevent this behavior, but the condition seems not to work. So all shortcuts like in the Windows task bar are removed when I do an update.
How can I make my update progress work correctly?
Here the behavior after update:
The group with all shortcuts in the right is missing!
You can combine the 2 component. By this you will not need to use condition statements.
The registry value is to set a keypath under component.
<Component Id="cmpstartmenuMyProgram" Guid="{67CB4F7A-5028-4697-A47F-DE99110B9645}">
<Shortcut Id="Shortcut.ApplicationName"
Name="ApplicationName"
Target="[INSTALLDIR]ApplicationName.exe"
WorkingDirectory="INSTALLDIR"
Directory="StartMenuFolder"
Icon="Icon.exe"/>
<RemoveFile Id="RemoveStartMenuShortcut.ApplicationName" Name="ApplicationName" Directory="StartMenuFolder" On="uninstall"/>
<RegistryValue Root="HKCU" Key="Software\Compony\ComponyName" Name="installed" Type="integer" Value="1" KeyPath="yes"/>
</Component>
I have a setup that has an optional parameter which should be written to the registry is supplied. I know that i can write to the registry using this:
<DirectoryRef Id="TARGETDIR">
<Component Id="RegistryEntries" Guid="*">
<RegistryKey Root="HKCU"
Key="Software\Microsoft\Test"
Action="create">
<RegistryValue Type="string" Value="[THEPARAMETER]"/>
</RegistryKey>
</Component>
</DirectoryRef>
But this will override the existing registry entry with an emtpy string, if the parameter is not specified!
I would like to know how to set the registry key ONLY if the parameter is specified. I have looked into custom actions and WriteRegistryValues, but I haven't found anything helpful.
Add the condition like this
<Condition>(THEPARAMETER AND (NOT Installed))</Condition>
<RegistryValue Type="string" Value="[THEPARAMETER]"/>
When i installed .msi file, I am getting generated shortcuts on start menu and desktop, but when i am uninstalling the desktop shortcut getting removed but start menu. My code is bellow. Please help me to solve my problem. I have spent almost 1 day behind this.
<Directory Id="ProgramMenuFolder">
<Directory Id="ProgramMenuSubfolder" Name="Kiosk">
<Component Id="ApplicationShortcuts" Guid="12345678-1234-1234-1234-333333333333">
<Shortcut Id="ApplicationShortcut1" Name="Kiosk" Description="Solusoft Product" Target="[INSTALLDIR]AMP\1.0.0.0\mpkiosk.exe" WorkingDirectory="INSTALLDIR"/>
<RegistryValue Root="HKCU" Key="Software\Kiosk" Name="installed" Type="integer" Value="1" KeyPath="yes"/>
<RemoveFolder Id="ApplicationShortcut1" On="uninstall"/>
</Component>
</Directory>
</Directory>
In my case, on the component, I had GUID="*" and the shorcuts weren't removed.
I used a hardcoded GUID like: Guid="cc509cb7-c1a1-46cf-8c62-7cbb0017783c" and the shortcuts were removed.
Regards.
You have a mistake in your code.
Instead of:
<RemoveFolder Id="ApplicationShortcut1" On="uninstall"/>
Use:
<RemoveFolder Id="ProgramMenuSubfolder" On="uninstall"/>
This should do it.
In my case, I was trying different options, and had a commented out section that had the same GUID. Changing it to a different GUID, even though the other was commented out, worked.
There is the code below that i'm using in my project. Hope, it will helps. I think you could use 'RemoveFile' instead 'RemoveFolder' and don't forget to put 'Name' attribute inside.
<RegistryKey Action="createAndRemoveOnUninstall" Root="HKCU"
Key="Software\$(var.ManufacturerEng)\$(var.ProductName)\$(var.ApplicationName)">
<RegistryValue Name="ShortcutService"
Type="integer" Value="1"
KeyPath="yes">
</RegistryValue>
</RegistryKey>
<Shortcut Advertise="no" Directory="ApplicationProgramsFolder"
Name="ServiceCC"
Target="[INSTALLLOCATION]Service.exe"
Id="SHORTCUT_serv"
WorkingDirectory="INSTALLLOCATION">
</Shortcut>
<RemoveFile Id="remove_serviceshort" Name="ServiceCC" On="uninstall"/>
<RemoveFolder Id="ApplicationProgramsFolder" On="uninstall"/>
</Component>
In my case it was a copy paste error. I was using the same Guid for the component as another product I had created a shortcut in that folder for. Hence on uninstall the removal of the icon failed