0

I'm trying to implement web.config editing during my install as is done here, but I'm coming up against an error when I build:

CNDL0005: the wix element contains an unexpected child element 'component'

This seems to suggest that Component should not be placed inside a product element. Yet, I'm using the same schema he is. It seems like I have to place my component inside a directory, inside a fragment, in order for msbuild to accept it. Anyone know why this is?

I've googled the error above and it returns no exact results.

I'm running Wix 3.9.

roryok
  • 9,325
  • 17
  • 71
  • 138

1 Answers1

1

WiX is an XML/XSD abstraction of the underlying Windows Installer database. This database is relational and has such tables as Feature, FetaureComponent, Component, Directory and File. Each of these tables has Primary Key and Foreign Key Columns. For Example

Feature<->FeatureComponent<->Component

Directory<->Component<->File

A directory can have more then one component but a component can only belong to one directory. Same thing can be said for components and files. Therefore in WiX the Directory element is a parent element of the Component element and the Component Element is the parent of a File element. WiX transforms these into PK FK relationships at build time. MSBuild merely calls the WiX compiler tools (candle (the source of your 'CNDL0005' error), light) and MSBuild doesn't know anything about this directly.

A feature can contain more then one component and a component can belong to more then one feature (many to many join). In this case WiX created the Feature <-> ComponentRef relationship.

The example you cite shows the elements in the correct relationship. You just aren't assembling it correctly. The Wix.chm in your startmenu has help topics for each element and lists which elements can be the parent, which can be a child and has a link to the related Windows Installer database table that the element represents.

Christopher Painter
  • 54,556
  • 6
  • 63
  • 100
  • `Therefore in WiX the Directory element is a parent element of the Component element` if you'll follow the first link in my post, you'll see an example of a Component element as a child of the Product element. Is that code incorrect? – roryok Jan 20 '15 at 16:39
  • It seems Component can be a child of Product if you set the Directory attribute. I never do that myself though. – Christopher Painter Jan 20 '15 at 16:51
  • Even with the Directory attribute set (as it is in the original example I quoted) I get the same error. – roryok Jan 20 '15 at 16:53
  • Is the component a child of Wix or Product? – Christopher Painter Jan 20 '15 at 16:55
  • It's a child of Product – roryok Jan 20 '15 at 16:59
  • 1
    Seems strange that candle would be saying it's a child of Wix. Either there's a candle bug our your reading the XML wrong. It's kinda hard to say since you haven't posted any code. I'd guess your code is wrong. – Christopher Painter Jan 20 '15 at 20:31
  • I just put it inside a Fragment / Directory instead. It's working now – roryok Jan 22 '15 at 11:51
  • Where did you get 30% from? This is only the second wix question I've ever asked on StackOverflow, and the first question only has one answer which didn't fix my issue. – roryok Jan 22 '15 at 15:27
  • My bad. I mixed my handles up for someone else who has recently asked a bunch of questions with follow up comments and no accepted answers. This answer has certainly answered your question. – Christopher Painter Jan 22 '15 at 15:34