Wix Installer PropertyRef架构验证错误

时间:2017-12-06 17:06:52

标签: xml wix

在我的PropertyRef元素中添加Package元素会在编译期间产生错误。

这是我的* .wxs文件

<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
 xmlns:netfx="http://schemas.microsoft.com/wix/NetFxExtension">
  <Product Id="*" Name="MyProduct" Language="1033" Version="!(bind.FileVersion.MyApplication.exe)" Manufacturer="MyManufacturer" UpgradeCode="SOME-GUID">
    <PropertyRef Id="WIX_IS_NETFRAMEWORK_461_OR_LATER_INSTALLED" />
    <Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />
    ...
  </Product>
  ...
</Wix>

这是visual studio产生的错误:

Schema validation failed with the following error at line 1, column 588: The element 'Product' in namespace 'http://schemas.microsoft.com/wix/2006/wi' has invalid child element 'PropertyRef' in namespace 'http://schemas.microsoft.com/wix/2006/wi'. List of possible elements expected: 'Package'.

查看PropertyRef的documentation表明Product应该是PropertyRef的有效父级。

1 个答案:

答案 0 :(得分:2)

可以通过将PropertyRef元素放在Package元素之后修复此错误。

<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
 xmlns:netfx="http://schemas.microsoft.com/wix/NetFxExtension">
  <Product Id="*" Name="MyProduct" Language="1033" Version="!(bind.FileVersion.MyApplication.exe)" Manufacturer="MyManufacturer" UpgradeCode="SOME-GUID">
    <Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />
    <PropertyRef Id="WIX_IS_NETFRAMEWORK_461_OR_LATER_INSTALLED" />
    ...
  </Product>
  ...
</Wix>