使用 WIX 工具时出现混合大小写 GUID 错误

mixed-case guid error while working with WIX tool

我使用 Wix 工具创建了一个 windows 安装程序 .msi 文件,但我遇到了一些错误

错误

1. Component/@Guid 属性的值“47845d50-01e6-40ff-8b53-14f664bfb13a”是大小写混合的 guid。 guid 值中的所有字母都应大写。 C 中的 FileWatcherSetup:\Main\Src\Installer\FileWatcherSetup\Components.wxs 11

2。组件 'FileWatcher.Files' 没有指定明确的键路径。如果 Component 元素下的元素顺序发生变化,键路径也会发生变化。为防止意外更改,应在以下位置之一将密钥路径设置为 'yes':Component/@KeyPath、File/@KeyPath、ODBCDataSource/@KeyPath 或 Registry/@KeyPath。 FileWatcherSetup C:\Main\Src\Installer\FileWatcherSetup\Components.wxs 47

3。 Product/@UpgradeCode 属性的值“11e6c23f-7a30-4651-b27a-b569765c3780”是大小写混合的 guid。 guid 值中的所有字母都应大写。 FileWatcherSetup C:\Main\Src\Installer\FileWatcherSetup\Product.wxs 9

任何人都知道如何解决这个问题。任何信息或文章都会有所帮助。请帮助

更新

components.wxs

   <?xml version="1.0" encoding="UTF-8"?>
   <Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">

   <?include Defines.wxi?>

   <Fragment>

   <ComponentGroup Id="MenuComponents" Directory="ProductMenuFolder">
   <Component Id="ProductMenuComponents" Guid="47845D50-01E6-40FF-8B53-14F664BFB13A">

    <!--<Shortcut Id="UninstallPackage" Directory="ProductMenuFolder" Name="Uninstall package"
              Target="[System64Folder]msiexec.exe" Arguments="/x {[ProductCode]}" Description="Uninstalls $(var.YourApplicationReference.TargetName)"/>-->
    <RemoveFolder Id='ProductMenuFolder' On='uninstall' />
    <RegistryValue Root='HKCU' Key='Software\[Manufacturer]\[ProductName]' 
    Type='string' Value='' KeyPath='yes' />

  </Component>
</ComponentGroup>

<ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
  <Component Id="FileWatcher">
    <File Source="$(var.FileWatcher.TargetPath)" />

    <!--Register this file as a Windows service-->
     <ServiceInstall Id="ServiceInstaller"
                    Type="ownProcess"
                    Description="Sends Incoming mainframe files to the MAID Webservice"
                    DisplayName="FileWatcher"
                    Vital="yes"
                    Start="auto"
                    ErrorControl="ignore"
                    Interactive="no"
                    Name="FileWatcher"
                    Account="[ACCOUNT]"
                    Password="[PASSWORD]">

         <!--<ServiceInstall Id="ServiceInstaller"
                    Type="ownProcess"
                    Description="Sends Incoming mainframe files to the MAID Webservice"
                    DisplayName="FileWatcher"
                    Vital="yes"
                    Start="auto"
                    ErrorControl="ignore"
                    Interactive="no"
                    Name="FileWatcher" >-->


      <ServiceConfig Id="svcConfig" DelayedAutoStart="yes" OnInstall="yes" OnReinstall="yes" OnUninstall="no" />
    </ServiceInstall>

    <!--Set the user to be used by the service-->
    <util:User Id="ServiceUser" Name="[ACCOUNT]" Password="[PASSWORD]" CreateUser="no" LogonAsService="yes" UpdateIfExists="yes" />

    <!--Added example of how to stop service automatically-->
    <ServiceControl Id="ServiceControl" Stop="both" Remove="uninstall" Name="FileWatcher" Wait="yes" />
  </Component>
    <Component Id="FileWatcher.Files" Guid="{946A48FD-42F1-404F-A610-5A3DB388BD16}">
    <!--<Component Id="MAIDFileWatcher.Files" Guid="{11E6C23F-7A30-4651-B27A-B569765C3780}">-->
      <File Id="filB93E7D71690869B9CD2D0A479DB69C6C" Source="$(var.FileWatcher.TargetDir)\ExceptionHandling.dll"  />
    <File Id="fil487232F7A833919419AF9537A4390083" Source="$(var.FileWatcher.TargetDir)\ExceptionHandling.xml" />
    <File Id="filDE3649B71309470D2D7C086E0FAABAE8" Source="$(var.FileWatcher.TargetDir)\itextsharp.dll"  />
    <File Id="filF73350F1AEF9ECF2621D4E63B9823029" Source="$(var.FileWatcher.TargetDir)\FileWatcher.exe.config"  KeyPath='yes'/>
  </Component>
</ComponentGroup>

正如 PhilDW 已经指出的那样,只需将您的 GUID 大写,或者将它们完全从您的组件中删除,如下所述:Syntax for guids in WIX?(它们将自动为您生成 - 有一些例外)。

此外,如果您的包不是很大,我建议每个组件使用一个文件。这避免了各种问题(打补丁、升级、自我修复等...): Change my component GUID in wix? 并为每个组件设置一个关键路径(如果每个组件只有一个文件,可能会为您完成,我不确定)。

很明显,但我要补充一点,您可以在 Visual Studio: Tools => Create GUID => Registry Format => New Guid => Copy 中创建大写 GUID。 Or a lot of web pages do it for you。我认为这是显而易见的,因为我正在写所以只是把它扔进去。

至于基本的 Windows 安装程序文档:

这里的 ProductCde 文档说需要大写:

https://msdn.microsoft.com/en-us/library/windows/desktop/aa370854(v=vs.85).aspx

组件 table 说 guid 必须大写:

https://msdn.microsoft.com/en-us/library/windows/desktop/aa368007(v=vs.85).aspx

并且 Guid 列类型文档再次重复大写要求:

https://msdn.microsoft.com/en-us/library/windows/desktop/aa368767(v=vs.85).aspx