Migrating from WiX 3.10 to WiX 4.0: unhandled extension element - wix

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.

Related

Wix : error LGHT0204 : ICE80: This 32BitComponent xxx uses 64BitDirectory yyy

I want to create an installer (msi) for my application. I want to add a folder that contains lot of files. So I use heat to create the wxs file for the folder. The wxs file created looks like this :
<?xml version="1.0" encoding="utf-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Fragment>
<DirectoryRef Id="INSTALLDIR">
<Directory Id="dirD443000E4EC0AE53948090C1CD372519" Name="www">
<Component Id="cmp258C40B6C01189153117075B9889DA7C" Guid="{23189859-29AE-46E6-A940-0B2307344910}">
<File Id="fil0DE52257C6EF99D33B0974915A17454E" KeyPath="yes" Source="$(var.WwwPath)\3rdpartylicenses.txt" />
</Component>
<Component Id="cmp85367E8DB342884A004620F1E4153AE4" Guid="{00EBB07A-6178-4072-B47C-2D9130CB96A7}">
<File Id="filB62696889B5411543CB3DFD6E2A1270D" KeyPath="yes" Source="$(var.WwwPath)\color.c7a33805ffda0d32bd2a.png" />
</Component>
...
...
When I run my command light, I get a lot of error like this one (one per file):
error LGHT0204 : ICE80: This 32BitComponent cmp258C40B6C01189153117075B9889DA7C uses 64BitDirectory dirD443000E4EC0AE53948090C1CD372519
But the msi created seems to work as expected. But I would like to understand and remove that error if I could.
Any idea ?
Thanks
I've tried adding componnents atrributes Win64='yes' like in #Brian's comment, but it removed during build.
This answer helped me solve this issue.

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

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.

Wix "Product element contains an unexpected child element util: RegistrySearch" error message on launch condition

I am totally new to Wix and I have been tasked with this.
The installer should prompt the message "Application requires Reportviewer". It should check if reportViewer is installed and if not throw the message at the beginning of installation itself.
This is what I am trying to do (randomly trying things out as I still do not understand the details)
<Condition Message="This application requires ReportViewer.">
<![CDATA[ReportViewerV10 OR ReportViewerWow64V10]]>
</Condition>
<util:RegistrySearch
Root="HKLM"
Key="SOFTWARE\Microsoft\ReportViewer\v10.0"
Value="Install"
Variable="ReportViewerV10"
Win64="yes"
/>
<util:RegistrySearch
Root="HKLM"
Key="SOFTWARE\Wow6432Node\Microsoft\ReportViewer\v10.0"
Value="Install"
Variable="ReportViewerWow64V10"
Win64="yes"
/>
You need to add a reference to http://schemas.microsoft.com/wix/UtilExtension in your main container tag in WIX project to refer util:RegistrySearch.
Document Should Look Like
<?xml version="1.0"?>
<Include xmlns="http://schemas.microsoft.com/wix/2003/01/wi">
.
.
.
</Include>
OR
<?xml version="1.0"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2003/01/wi">
.
.
.
</Wix>
You can keep this utility call in a Bundle tag or a Fragment tag only.
Refer RegistrySearch Element (Util Extension) Documentation for more details on this.
Refer WIX Documenation for more ideas.

Wix Event Log Not Getting Created

I'm trying to create an Event Log and Event Source at install time using Wix. The install doesn't fail or give any error...but I don't see any Event Log called MyApp getting created.
<PropertyRef Id="NETFRAMEWORK40FULLINSTALLROOTDIR"/>
<Component Id="EventLog" Guid="AD09F8B9-80A0-46E6-9E36-9618E2023D67">
<util:EventSource Log="MyApp" Name="MyApp" EventMessageFile="[NETFRAMEWORK40FULLINSTALLROOTDIR]EventLogMessages.dll" />
</Component>
I previously had a .NET Installer class that did this and it worked without a problem.
What am I doing wrong?
I had problems with this, and it was because I was missing a <CreateFolder /> element; my code ended up looking like this:
<Component Id="CreateEventLog32Bit" Guid="{some-guid}" Permanent="yes">
<Condition><![CDATA[NETFRAMEWORK40FULLINSTALLROOTDIR AND NOT VersionNT64]]></Condition>
<CreateFolder />
<util:EventSource Log="Application" Name="MyApp" EventMessageFile="[NETFRAMEWORK40FULLINSTALLROOTDIR]EventLogMessages.dll" />
</Component>
<Component Id="CreateEventLog64Bit" Guid="{some-other-guid}" Permanent="yes">
<Condition><![CDATA[NETFRAMEWORK40FULLINSTALLROOTDIR64 AND VersionNT64]]></Condition>
<CreateFolder />
<util:EventSource Log="Application" Name="MyApp" EventMessageFile="[NETFRAMEWORK40FULLINSTALLROOTDIR64]EventLogMessages.dll" />
</Component>
(so it can handle both 32-bit and 64-bit installs of .NET 4)
Can you post an installer log? The EventSource element is really just some syntatical sugar. WiX translates these into simple registry keys/values and I've never seen it fail in any of the installs I've used it in.

writing registry in wix - problem illustrated with sample wxs file

I am trying to write to registry using Wix.
it is failing showing the error
"The error code is 2727"
to run this sample follow the below steps.
you need a text file in c:\testinstall.txt
it installs the file testinstall.txt in
C:\Program Files\testinstall
candle sample.wxs
light sample.wixobj
sample.msi will be created
when i add this entry in the script
it is failing.
all i need is to have a script which will create a key and write some value into the
registry.
sample.wxs code
2
<Registry Id="TestKey"
Root="HKLM"
Key="SOFTWARE\testCorp"
Action="createKeyAndRemoveKeyOnUninstall">
<Registry Id="TestValue"
Name="TestValue"
Action="write"
Value="123"
Type="string" />
</Registry>
</Component>
</Directory>
</Directory>
</Directory>
<Feature Id="Feature" Level="1">
<ComponentRef Id="component0" />
<ComponentRef Id="ID0EAAA" />
</Feature>
Are you using WiX v2? Instead of creating the registry value with two Registry entries, just combine it all into one line.
<Registry Id="TestKey" Root="HKLM" Key="SOFTWARE\testCorp" Name="TestValue" Value="123" Type="string" Action="write" />
That's usually a lot easier. If you really want to nest them then I recommend leaving the Registry/#Action attribute off of the parent registry key so it doesn't actually end up in the MSI. Just organizes the child elements.
Note the syntax is a bit different in WiX v3.