构建期间的 WIX 安装程序错误

WIX Installer error during the build

我在 Visual Studio 2012 年尝试学习如何使用 WIX 安装程序,首先我创建了一个 HelloWorld 项目来测试 WIX 并进行简单的配置。但是我在构建过程中遇到错误:它说我:

"Failed to open the database. During validation, this most commonly happens when attempting to open a database using an unsupported code page or a file that is not a valid Windows Installer database. Please use a different code page in Module/@Codepage, Package/@SummaryCodepage, Product/@Codepage, or WixLocalization/@Codepage; or make sure you provide the path to a valid Windows Installer database. light.exe 0 1 SetupProject1"

我看到了几个解决方案,比如更改 XML 的编码,将 utf-8 切换为 utf-16。我也尝试删除编码语句。但它没有任何改变。

这是我的 WIX XML :

    <?xml version="1.0" encoding="utf-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
  <Product Id="54612752-7163-4B36-8CA6-01615090CD7F" Name="WIXTestSetup" Language="1033" Codepage="1252" Version="1.0.0.0" Manufacturer="MyCompany Ltd."
  UpgradeCode="1756bfd5-c713-412a-9524-fb1b72886116">
    <Package Id="*" Keywords="Installer" Description="My WIXTest Installer" Languages="1033" SummaryCodepage="1252" InstallerVersion="200"
    Compressed="yes" InstallScope="perMachine" Comments="WIXTest Installer is a registered trademark of MyCompany and Co.Ltd" />
    <Media Id="1" Cabinet="Sample.cab" EmbedCab="yes" DiskPrompt="CD-ROM #1" />
    <Property Id="DiskPrompt" Value="WIXTestSetup Installation [1]"/>
    <MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />


    <Feature Id="ProductFeature" Title="WIXTestSetup" Level="1">
      <ComponentGroupRef Id="ProductComponents" />
    </Feature>
  </Product>

  <Fragment>
    <Directory Id="TARGETDIR" Name="SourceDir">
      <Directory Id="ProgramFilesFolder" Name="PFiles">
        <Directory Id="MyCompany" Name = "MyCompany" >
          <Directory Id="INSTALLFOLDER" Name="WIXTestSetup" />
        </Directory>
      </Directory>
    </Directory>
  </Fragment>

  <Fragment>
    <ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
      <!-- TODO: Remove the comments around this Component element and the ComponentRef below in order to add resources to this installer. -->
      <Component Id="MainExecutable" Guid="4BFF8919-9C07-4BBE-BD1C-46AB49524566">
        <!-- TODO: Insert files, registry keys, and other resources here. -->
        <File Id="WIxTestExe" Name ="WIXTest.exe" DiskId="1" Source="D:\PROJETS VISUAL STUDIO\Projects\MyFirstWIXProject\MyFirstWIXProject\bin\Debug\MyFirstWIXProject.exe" KeyPath="yes" />
      </Component>
      <Component Id="ProgramFilesFolder" Guid="53B3FC8A-9D2B-4CDD-BE68-D155435C6163">
        <RemoveFolder Id="ProgramFilesFolder" On="uninstall"/>
      </Component>
    </ComponentGroup>
  </Fragment>
</Wix>

我也检查了 "CodePage" 和 "SummaryCodePage" 但我没有解决构建问题。

我也试过了:WiX ICE validation errors

你有什么办法来解决这个问题吗?

在数据库验证步骤中,light.exe 尝试重新打开 MSI 文件以进行 read/write 访问,同时防病毒扫描已创建的新 msi 文件。

尝试执行以下操作:

  1. 从实时病毒扫描中排除临时目录。
  2. 在 Windows 区域设置中添加英文输入语言。
  3. 禁用 ICE 验证。转到wix项目属性,工具设置,然后选中"Suppress ICE validation"。

您可以在此处查看与此主题相关的讨论:

Error LGHT0301: Failed to open the database