WiX: Error RegistryKey element contains an unexpected attribute 'ForceDeleteOnUninstall' - wix

I'm new to WiX. I just installed WixW 3.7 in order to build an open source JiraSVN plugin. But the build breaks in Visual Studio with the following errors:
The RegistryKey element contains an unexpected attribute 'ForceDeleteOnUninstall'.
The RegistryKey element contains an unexpected attribute 'ForceCreateOnInstall'.
These errors reference the product.wxs file, which contains the following elements:
<Component Id="C__Registry" Guid="{40D60013-...D30D5}" Win64="yes">
<RegistryKey Root="HKCR" Key="CLSID\{CF732FD7-...1A7E9D}" ForceDeleteOnUninstall="yes">
<RegistryValue Value="TortoiseSVN Jira Plugin" Type="string" Action="write" />
<RegistryKey Key="Implemented Categories">
<RegistryKey Key="{3494FA92-...5E7831}" ForceCreateOnInstall="yes" /> </RegistryKey>
</RegistryKey>
</Component>
I am also getting warnings such as:
The 'ForceDeleteOnUninstall' attribute is not declared.
The 'ForceCreateOnInstall' attribute is not declared.
From what I can find in the WiX documentation, these are standard attributes in the WiX framework. So what could be causing them to be unrecognized? Where should they be declared?

First, why are you adding those attributes? From the snippet you sent they are unnecessary and just going to bloat your install. No need to force anything there.
Second, you must have WiX v3.5 or less installed on your Visual Studio machine. Those attributes were added in WiX v3.6.

Related

WIX registry key entry fails using Auto Generated GUID

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.

Migrating from WiX 3.10 to WiX 4.0: unhandled extension element

I'm migrating from WiX Toolset 3.10 to 4.0-pre. Updating namespaces went ok, but I'm still getting some errors in my NAnt build log.
I have Installer.wxs file:
<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs"
xmlns:util="http://wixtoolset.org/schemas/v4/wxs/util">
<Product ...>
<DirectoryRef Id="FolderCommon">
...
<Component Id="Registration_Component_12" Guid="..." KeyPath="yes">
<?include VS2012Package.wxi.bak?>
...
</Component>
...
</DirectoryRef>
...
</Product>
Where VS2012Package.wxi.bak file is generated via RegPkg.exe:
<Include>
<Registry Root="HKLM" Key="SOFTWARE\Microsoft\VisualStudio\11.0\InstalledProducts\VsPackage">
<Registry Name="Package" Value="..." Type="string" />
<Registry Name="UseInterface" Value="1" Type="integer" />
</Registry>
...
And my build fails with errors like this:
[exec] ...\Installer\VS2012Package.wxi.bak(3) : error CNDL0200 : The Component element contains an unhandled extension element 'Registry'. Please ensure that the extension for elements in the '' namespace has been provided.
I tried to add namespace 'http://wixtoolset.org/schemas/v4/wxs' to "<Include>" tag in VS2012Package.wxi.bak using external script before building, but errors just changed to error CNDL0005 : The Component element contains an unexpected child element 'Registry'
Thanks for any help!
The Registry element was deprecated in WiX v3.x and is obsoleted in WiX v4.x. Use RegistryValue instead.

WiX 3: Error 1406: Could not write value {ValueName} to key {KeyName}

I recently converted an old WiX 2 project to WiX 3. In the previous WiX project there was a component that contained a number of shortcuts, as follows.
<Component Id="ShortcutsComponent" Guid="$(var.ShortcutsComponentGuid)">
<Shortcut Id="Shortcut1" Name="Shortcut1Name" LongName="Shortcut1LongName"
Directory="ShortcutsDir" Target="{Target}" />
<Shortcut Id="Shortcut2" Name="Shortcut2Name" LongName="Shortcut2LongName"
Directory="ShortcutsDir" Target="{Target}" />
</Component>
When I converted the project to WiX 3 this caused the following error.
error LGHT0204 : ICE43: Component ShortcutsComponent has non-advertised shortcuts. It's KeyPath registry key should fall under HKCU.
To resolve the error I made modified the ShortcutsComponent by adding a RegistryValue element as follows.
From our Variables.wxi file.
<?define JAWSVersion = "$(env.Major).0"?>
<?define FSRegistryKey = "SOFTWARE\Freedom Scientific"?>
<?define JAWSRegistryKey = "$(var.FSRegistryKey)\JAWS"?>
And in the WXS file, which includes Variables.wxi, I added the following line to ShortcutsComponent.
<RegistryValue
Root="HKCU" Key="$(var.JAWSRegistryKey)\$(var.JAWSVersion)\Components"
Name="ShortcutsComponent" Action="write" Type="integer" Value="1"
KeyPath="yes" />
I made similar changes to a number of components.
Now I am getting errors when installing the software, but only on some computers. The error is as follows.
Error 1406: Could not write value {ValueName} to key {KeyName}.
System error. Verify that you have sufficient access to that key,
or contact your support personnel.
I considered replacing the above RegistryValue line with something like the following but I do not expect the results to be any different.
<RegistryKey Root="HKCU" Key="$(var.FSRegistryKey)" Action="create">
<RegistryKey Key="JAWS" Action="create">
<RegistryKey Key="$(var.JAWSVersion)" Action="create">
<RegistryKey Key="Components" Action="create">
<RegistryValue
Name="ShortcutsComponent" Action="write"
Type="integer" Value="1" KeyPath="yes" />
</RegistryKey>
</RegistryKey>
</RegistryKey>
</RegistryKey>
Does anyone have any suggestions on how to solve this problem?
NOTE: I was asked to give the precise values for {ValueName} and {KeyName}. Here are the relevant lines from the log file.
MSI (s) (1C:8C) [14:36:29:183]: Executing op: RegOpenKey(Root=-2147483647,Key=SOFTWARE\Freedom Scientific\JAWS\17.0\Components,,BinaryType=1,,)
MSI (s) (1C:8C) [14:36:29:183]: Executing op: RegAddValue(Name=RemoveExploreDir,Value=#1,)
WriteRegistryValues: Key: \SOFTWARE\Freedom Scientific\JAWS\17.0\Components, Name: RemoveExploreDir, Value: #1
MSI (s) (1C:8C) [14:36:29:183]: Note: 1: 1401 2: HKEY_CURRENT_USER\SOFTWARE\Freedom Scientific\JAWS\17.0\Components 3: 1021
Error 1406. Could not write value RemoveExploreDir to key \SOFTWARE\Freedom Scientific\JAWS\17.0\Components. System error . Verify that you have sufficient access to that key, or contact your support personnel.
MSI (s) (1C:8C) [14:40:09:789]: Product: Freedom Scientific JAWS 17.0 -- Error 1406. Could not write value RemoveExploreDir to key \SOFTWARE\Freedom Scientific\JAWS\17.0\Components. System error . Verify that you have sufficient access to that key, or contact your support personnel.
I hope this helps.
This is more of a report of a discovery than an answer. As it turns out the problem was not in the WiX code but in a custom action contained in a DLL that is used by the installer. This custom action created the registry key "HKEY_CURRENT_USER\Software\Freedom Scientific\RJSetup" with the REG_OPTION_VOLATILE option. What this means is that if the "HKEY_CURRENT_USER\Software\Freedom Scientific" did not already exist, it too was created with the REG_OPTION_VOLATILE option. When the WiX installer attempted to write to any key under "HKEY_CURRENT_USER\Software\Freedom Scientific" this caused the Error 1406. We are fixing the custom action so that it first creates the "HKEY_CURRENT_USER\Software\Freedom Scientific" registry key as a standard key and then creates the "HKEY_CURRENT_USER\Software\Freedom Scientific\RJSetup" registry key with the REG_OPTION_VOLATILE option. That hopefully will fix the problem.
The moral of the story is, if you find an odd error in a WiX installer that you cannot figure out in code that appears to be consistent with thousands of resources found online consider the possibility that you are shooting yourself in the foot in one of your custom actions.

How to write a registry key and value in bundle of wix?

I can write a registry key and value in setup project of wix,the code like this:
<RegistryKey Id="WinApp" Root="HKLM" Key="Software\App\[ProductName]" Action="createAndRemoveOnUninstall" >
<RegistryValue Type="string" Name="InstallName" Value="[ProductName]" Action="write" KeyPath="yes"></RegistryValue>
</RegistryKey>
How can i do in bootstrapper project?
Bundles do not modify the machine state. The registry key should be placed in one of the chained packages to be part of the installation transaction.

Add a new CLSID to windows registry using WiX

I am trying to register a new filter with Windows Desktop Search. Ideal way to achieve do this would be registering new filter with existing persistent handler CLSID. But this cannot be done since .html PersistentHandler CLSID, {eec97550-47a9-11cf-b952-00aa0051fe20}, is protected under WRP (More about the problem).
As a workaround, I am trying to create a different CLSID that does the same job as {eec97550-47a9-11cf-b952-00aa0051fe20}.
This is the sample code I am following. I am quite new to WiX and editing Windows registry.
<File Id="HTMLfilter.DLL">
<Class Id="$(var.CLSID_HtmlIFilter)" Context="InprocServer32" ThreadingModel="both" Description="Html Filter" />
</File>
Could someone help me regarding these;
How to create a CLSID that is not affiliated to any file? Since my
new CLSID is doing the work of above mentioned CLSID, I think this is
how it should be.
How to create a a sub-directory named PersistentAddinsRegistered
instead of InprocSever32
Thanks
Have a look at this page here shows how to add COM objects to installers
I suggest export selected branch to registry file (Export all or part of the registry to a text file).
Then using Heat.exe harvest registry file and include its output in your project.
This is an example
<Fragment>
<DirectoryRef Id="TARGETDIR">
<Component Id="cmp6E2CE62C9ADECD355465514E3C8F354E" Guid="PUT-GUID-HERE" KeyPath="yes">
<RegistryKey Key=".ascx\PersistentHandler" Root="HKCR">
<RegistryValue Value="{eec97550-47a9-11cf-b952-00aa0051fe20}" Type="string" />
</RegistryKey>
</Component>
</DirectoryRef>
</Fragment>