Wix-在ComponentGroup中添加具有/不具有GUID的组件

当我的应用程序想要退出时,在Windows日志中发生了一个错误,我需要在安装程序中添加一个EventSource,定义一个EventMessageFile,它将是.NET Framework的事件日志消息文件(我正在关注该解决方案:https:/ /stackoverflow.com/a/574055/6617804)。


在我的Component.wxs中,将Id LogsNet的组件添加到此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>

当我尝试以这种方式添加它(不生成GUID)时,会导致该错误:


Component / @ Guid属性的值“ *”对此组件无效,因为它不符合具有自动生成的guid的条件。使用目录作为KeyPath或包含ODBCDataSource子元素的组件不能使用自动生成的guid。确保您的组件没有目录作为KeyPath,并将任何ODBCDataSource子元素移动到具有显式组件向导的组件。OptifuelInfomax_Installer(OptifuelInfomax_Installer \ OptifuelInfomax_Installer)C:\ Source \ Infomax \ OptiFuelInfomax \ OptifuelInfomax_Installer \ Components.wxs 80


而当我生成一个GUID与Visual Studio中的工具- >创建GUID(注册表格式),它说在错误列表:


Component元素包含意外的属性'GUID'。OptifuelInfomax_Installer(OptifuelInfomax_Installer \ OptifuelInfomax_Installer)C:\ Source \ Infomax \ OptiFuelInfomax \ OptifuelInfomax_Installer \ Components.wxs 80


它还在IDE中说:不允许使用'GUID'属性。


我应该为该组件使用GUID吗?


慕莱坞森
浏览 332回答 2
2回答
打开App,查看更多内容
随时随地看视频慕课网APP