在 WIX 3.9 中分配文件安装文件夹时出错
Error allocating file install folder in WIX 3.9
我正在为我的安装程序设置安装位置。但是,当我尝试设置位置时它会抛出错误。源代码:
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="*" Name="Wix_setup" Language="1033" Version="1.0.0.0" Manufacturer="Frank Jansen" UpgradeCode="37a42e55-dea8-47da-8f4f-fb065dd38a9e">
<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
<MediaTemplate EmbedCab="yes"/>
<Feature Id="ProductFeature" Title="Wix_setup" Level="1">
<!--create a seperate ComponentGroupRef and Fragment for each extra added program-->
<ComponentGroupRef Id="InstallationFiles" />
<ComponentGroupRef Id="DLLs" />
<ComponentGroupRef Id="IniFiles" />
<ComponentGroupRef Id="Scripts" />
<ComponentGroupRef Id="TeamViewer" />
<ComponentGroupRef Id="Wix_database" />
</Feature>
</Product>
<Fragment>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="INSTALLFOLDER" Name="Wix_setup" />
</Directory>
</Directory>
<Property Id="WIXUI_INSTALLDIR" Value="INSTALLFOLDER" ></Property>
<UIRef Id="WixUI_InstallDir"/>
</Fragment>
<Fragment>
<ComponentGroup Id="DLLs" Directory="INSTALLFOLDER">
<Component Id="cmp0F2CCC19DBBB1A659BB614D21AAFB413" Guid="{1B34DA48-A891-4923-8437-8116FB986A4E}">
<File Id="filFD63715191DEBF4B34A2836B7D53C62B" KeyPath="yes" Source="C:\Users\fjansen\Documents\MMI installatie bestanden\MMI install files\Program Files\ActiveX Control Pad\ScrWiz.dll" />
</Component>
</ComponentGroup>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder" />
</Directory>
</Fragment>
在这个例子中我想做的是将一个文件放在程序文件文件夹中。但是当我构建解决方案时,它会抛出以下错误:
Error 3 Duplicate symbol 'Directory:ProgramFilesFolder' found. This typically means that an Id is duplicated. Check to make sure all your identifiers of a given type (File, Component, Feature) are unique.
Error 1 Duplicate symbol 'Directory:TARGETDIR' found. This typically means that an Id is duplicated. Check to make sure all your identifiers of a given type (File, Component, Feature) are unique.
我不明白为什么会出现这些错误。我需要将多个 pad 定义到多个位置,这些 pad 的某些部分与其他部分相同,这意味着,例如,我需要为不同的文件多次使用 ProgramFilesFolder。但是现在我这样做时出现错误。
我做错了什么?
您不能为目录重复 ID。
试试下面的代码:
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="*" Name="Wix_setup" Language="1033" Version="1.0.0.0" Manufacturer="Frank Jansen" UpgradeCode="37a42e55-dea8-47da-8f4f-fb065dd38a9e">
<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
<MediaTemplate EmbedCab="yes"/>
<Feature Id="ProductFeature" Title="Wix_setup" Level="1">
<!--create a seperate ComponentGroupRef and Fragment for each extra added program-->
<ComponentGroupRef Id="InstallationFiles" />
<ComponentGroupRef Id="DLLs" />
<ComponentGroupRef Id="IniFiles" />
<ComponentGroupRef Id="Scripts" />
<ComponentGroupRef Id="TeamViewer" />
<ComponentGroupRef Id="Wix_database" />
</Feature>
</Product>
<Fragment>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="INSTALLFOLDER" Name="Wix_setup" />
</Directory>
</Directory>
<Property Id="WIXUI_INSTALLDIR" Value="INSTALLFOLDER" ></Property>
<UIRef Id="WixUI_InstallDir"/>
</Fragment>
<Fragment>
<ComponentGroup Id="DLLs" Directory="INSTALLFOLDER">
<Component Id="cmp0F2CCC19DBBB1A659BB614D21AAFB413" Guid="{PUT-GUID-HERE}">
<File Id="filFD63715191DEBF4B34A2836B7D53C62B" KeyPath="yes" Source="C:\Users\fjansen\Documents\MMI installatie bestanden\MMI install files\Program Files\ActiveX Control Pad\ScrWiz.dll" />
</Component>
</ComponentGroup>
</Fragment>
</Wix>
这个结构应该能帮到你。
引用CommonFilesFolder的id
<Fragment>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="INSTALLFOLDER" Name="Wix_setup" />
<Directory Id="CommonFilesFolder" />
</Directory>
</Directory>
</Fragment>
这个link将来可能对你有帮助
https://msdn.microsoft.com/en-us/library/s2esdf4x%28VS.80%29.aspx
我正在为我的安装程序设置安装位置。但是,当我尝试设置位置时它会抛出错误。源代码:
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="*" Name="Wix_setup" Language="1033" Version="1.0.0.0" Manufacturer="Frank Jansen" UpgradeCode="37a42e55-dea8-47da-8f4f-fb065dd38a9e">
<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
<MediaTemplate EmbedCab="yes"/>
<Feature Id="ProductFeature" Title="Wix_setup" Level="1">
<!--create a seperate ComponentGroupRef and Fragment for each extra added program-->
<ComponentGroupRef Id="InstallationFiles" />
<ComponentGroupRef Id="DLLs" />
<ComponentGroupRef Id="IniFiles" />
<ComponentGroupRef Id="Scripts" />
<ComponentGroupRef Id="TeamViewer" />
<ComponentGroupRef Id="Wix_database" />
</Feature>
</Product>
<Fragment>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="INSTALLFOLDER" Name="Wix_setup" />
</Directory>
</Directory>
<Property Id="WIXUI_INSTALLDIR" Value="INSTALLFOLDER" ></Property>
<UIRef Id="WixUI_InstallDir"/>
</Fragment>
<Fragment>
<ComponentGroup Id="DLLs" Directory="INSTALLFOLDER">
<Component Id="cmp0F2CCC19DBBB1A659BB614D21AAFB413" Guid="{1B34DA48-A891-4923-8437-8116FB986A4E}">
<File Id="filFD63715191DEBF4B34A2836B7D53C62B" KeyPath="yes" Source="C:\Users\fjansen\Documents\MMI installatie bestanden\MMI install files\Program Files\ActiveX Control Pad\ScrWiz.dll" />
</Component>
</ComponentGroup>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder" />
</Directory>
</Fragment>
在这个例子中我想做的是将一个文件放在程序文件文件夹中。但是当我构建解决方案时,它会抛出以下错误:
Error 3 Duplicate symbol 'Directory:ProgramFilesFolder' found. This typically means that an Id is duplicated. Check to make sure all your identifiers of a given type (File, Component, Feature) are unique.
Error 1 Duplicate symbol 'Directory:TARGETDIR' found. This typically means that an Id is duplicated. Check to make sure all your identifiers of a given type (File, Component, Feature) are unique.
我不明白为什么会出现这些错误。我需要将多个 pad 定义到多个位置,这些 pad 的某些部分与其他部分相同,这意味着,例如,我需要为不同的文件多次使用 ProgramFilesFolder。但是现在我这样做时出现错误。
我做错了什么?
您不能为目录重复 ID。 试试下面的代码:
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="*" Name="Wix_setup" Language="1033" Version="1.0.0.0" Manufacturer="Frank Jansen" UpgradeCode="37a42e55-dea8-47da-8f4f-fb065dd38a9e">
<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
<MediaTemplate EmbedCab="yes"/>
<Feature Id="ProductFeature" Title="Wix_setup" Level="1">
<!--create a seperate ComponentGroupRef and Fragment for each extra added program-->
<ComponentGroupRef Id="InstallationFiles" />
<ComponentGroupRef Id="DLLs" />
<ComponentGroupRef Id="IniFiles" />
<ComponentGroupRef Id="Scripts" />
<ComponentGroupRef Id="TeamViewer" />
<ComponentGroupRef Id="Wix_database" />
</Feature>
</Product>
<Fragment>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="INSTALLFOLDER" Name="Wix_setup" />
</Directory>
</Directory>
<Property Id="WIXUI_INSTALLDIR" Value="INSTALLFOLDER" ></Property>
<UIRef Id="WixUI_InstallDir"/>
</Fragment>
<Fragment>
<ComponentGroup Id="DLLs" Directory="INSTALLFOLDER">
<Component Id="cmp0F2CCC19DBBB1A659BB614D21AAFB413" Guid="{PUT-GUID-HERE}">
<File Id="filFD63715191DEBF4B34A2836B7D53C62B" KeyPath="yes" Source="C:\Users\fjansen\Documents\MMI installatie bestanden\MMI install files\Program Files\ActiveX Control Pad\ScrWiz.dll" />
</Component>
</ComponentGroup>
</Fragment>
</Wix>
这个结构应该能帮到你。 引用CommonFilesFolder的id
<Fragment>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="INSTALLFOLDER" Name="Wix_setup" />
<Directory Id="CommonFilesFolder" />
</Directory>
</Directory>
</Fragment>
这个link将来可能对你有帮助
https://msdn.microsoft.com/en-us/library/s2esdf4x%28VS.80%29.aspx