为什么wix项目出错?

时间:2015-11-26 07:31:27

标签: visual-studio wix windows-installer

我正在使用Wix工具集3.8,我尝试创建一个msi项目。在构建时我遇到了类似这样的错误:

Severity    Code    Description Project File    Line
Error       '.', hexadecimal value 0x00, is an invalid character.   Analyzer    light.exe   0

有人遇到过这样的问题吗?任何帮助将不胜感激!我是这个领域的初学者...... 这是源代码:

<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
  <?define ProductName="Traffic_Analyzer" ?>
  <?define ProductVersion="1.0.0.0" ?>
  <?define ProductCode="*"?>
  <?define UpgradeCode="9e36a864-f98e-446a-b2e6-dd77567a4031"?>
  <?define Manufacturer="Leanenka_Dzianis"?>
  <?define licenseRtf="C:\Users\DzianisL\Desktop\license.rtf"?>

  <Product Id="$(var.ProductCode)" Name="$(var.ProductName)" Language="1049" Version="$(var.ProductVersion)"
           Manufacturer="$(var.Manufacturer)" UpgradeCode="$(var.UpgradeCode)">
    <!--1033 on 1049 - Russian language maintaines-->
    <Package InstallerVersion="200" Compressed="yes" />

    <MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
    <MediaTemplate />

    <Directory Id="TARGETDIR" Name="SourceDir">
      <Directory Id="ProgramFilesFolder">
        <Directory Id="INSTALLLOCATION" Name="$(var.ProductName)">

          <Component Id="ProductComponent" Guid="*">
            <File Id='Sniffer' DiskId='1' Source='C:\Users\DzianisL\Documents\Visual Studio 2015\Projects\Sniffer\Sniffer\bin\Release\Sniffer.exe'/>
          </Component>
        </Directory>
      </Directory>

      <Directory Id="ProgramMenuFolder">
        <Directory Id="ApplicationProgramsFolder" Name="$(var.ProductName)">
          <Component Id="ApplicationShortcutSniffer" Guid="4CEBD68F-E933-47f9-B02C-A4FC69FDB551">
            <Shortcut Id="ShortcutSniffer"
                 Name="Sniffer"
                 Description="$(var.ProductName)"
                 Target="[INSTALLLOCATION]Sniffer.exe"
                 WorkingDirectory="INSTALLLOCATION"/>
            <RemoveFolder Id="ApplicationProgramsFolder" On="uninstall"/>
            <RegistryValue Root="HKCU" Key="Software\$(var.Manufacturer)\$(var.ProductName)" Name="installed" Type="integer" Value="1" KeyPath="yes"/>
          </Component>
        </Directory>
      </Directory>
    </Directory>


    <Feature Id="ProductFeature" Title="$(var.ProductName)" Level="1">
      <ComponentRef Id="ProductComponent" />
      <ComponentRef Id="ApplicationShortcutSniffer" />
    </Feature>
    <Property Id="WIXUI_INSTALLDIR" Value="INSTALLLOCATION" ></Property>
    <WixVariable Id="WixUILicenseRtf" Overridable="yes" Value="$(var.licenseRtf)"/>
    <UIRef Id="WixUI_InstallDir"/>




  </Product>

</Wix>

2 个答案:

答案 0 :(得分:5)

WiX问题跟踪器中有一个open bug report,表示该错误与以空字符结尾的RTF文件相关。

我会检查你的license.rtf是否以null结尾,然后从文件中截断该字符(或者创建一个没有null的新RTF文件)

答案 1 :(得分:-2)

我解决了此错误:

'。',十六进制值0x00,是无效字符

通过注释此行:

<UIRef Id="WixUI_InstallDir" />