0

Having a bug occurring through the windows log when my application want to exit, I need to add in my installer an EventSource defining an EventMessageFile which will be the Event log message file of the .NET Framework (I am following that solution : https://stackoverflow.com/a/574055/6617804).

In my Component.wxs, I add the Component of Id LogsNet in this ComponentGroup LogsComponents :

<ComponentGroup Id="LogsComponents" Directory="LogsFolder">
  <Component Id="Logs" Guid="{339873E0-0984-4A1B-8C53-0F64DFAD56BC}">
    <File Id="..." Source="..." />
    <File Id="..." Source="..." />
    <File Id="..." Source="..." />
    <File Id="..." Source="..." />
    <RemoveFolder Id='LogsFolder' On='uninstall' />
    <RegistryValue Root='HKCU'
                       Key='Software\[Manufacturer]\[ProductName]'
                       Type='string'
                       Value=''
                       KeyPath='yes' />
  </Component>

  <Component Id="LogsNET" >
    <util:EventSource
       Log="Application" Name="ROOT Builder"
       EventMessageFile="%SystemRoot%\Microsoft.NET\Framework\v2.0.50727\EventLogMessages.dll"/>
  </Component>
</ComponentGroup>

When I try to add it that way (without generating a GUID), it brings about that 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. Components using a Directory as a KeyPath or containing ODBCDataSource child elements cannot use an automatically generated guid. Make sure your component doesn't have a Directory as the KeyPath and move any ODBCDataSource child elements to components with explicit component guids. OptifuelInfomax_Installer (OptifuelInfomax_Installer\OptifuelInfomax_Installer) C:\Source\Infomax\OptiFuelInfomax\OptifuelInfomax_Installer\Components.wxs 80

And when I generate a GUID with Visual Studio in Tools -> Create GUID (Registry Format), it says in the error list :

The Component element contains an unexpected attribute 'GUID'. OptifuelInfomax_Installer (OptifuelInfomax_Installer\OptifuelInfomax_Installer) C:\Source\Infomax\OptiFuelInfomax\OptifuelInfomax_Installer\Components.wxs 80

And it also says in the IDE : The 'GUID' attribute is not allowed.

Am I supposed to use a GUID for that Component ?

3
  • 2
    Guid is different from GUID, Casing is important. Commented Apr 10, 2018 at 12:17
  • 1
    Yes, the attribute should be, for example, Guid="994b5fa4-61dc-4b73-8c5e-f83eed3d7c1a" Commented Apr 10, 2018 at 12:19
  • You guys are right! I will update soon with other errors in this particular case Commented Apr 10, 2018 at 12:20

2 Answers 2

1

It is saying "The 'GUID' attribute is not allowed" simply because it does not recognize the attribute 'GUID' - it is case sensitive ; the real attribute name is 'Guid' and so it is compiling with :

<Component Id="LogsNET" Guid ="{...blah123...}">
    <util:EventSource
       Log="Application" Name="ROOT Builder"
       EventMessageFile="%SystemRoot%\Microsoft.NET\Framework\v2.0.50727\EventLogMessages.dll"
       KeyPath="yes"/>
  </Component>
Sign up to request clarification or add additional context in comments.

1 Comment

Hi, please see my answer on the issue of hard coded path to prevent that problem from hitting you suddenly and unexpectedly. Hard coded paths are guaranteed to cause problems sooner or later - certainly if you target diverse computers and not standardized, corporate computers.
1

One more thing, I will add this as an answer to get in the links and the disclaimers:

I haven't done much EventMessageFile installation, but I just want to add that hard coded paths are always wrong (your use of %SystemRoot% would probably still work). As you no doubt know, it is not uncommon for the system partition to be something other than C:\. Please see this particular answer (it is a particular answer from the "thread" you have linked to yourself) for how to eliminate your hard coded paths: How do you create an event log source using WiX.

Also, here is the documentation for the built-in WiX .NET properties: WixNetfxExtension (a bit down the page). I would also recommend you install using one file per component. Certainly do not install multiple binaries in the same component - this is a violation of the component rules. And a Symantec article on component rules as well.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.