我正在爲我的安裝程序設置安裝位置。但是,當我嘗試設置位置時,它會引發錯誤。源代碼:在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.
我不明白爲什麼會出現這些錯誤。我需要定義多個焊盤到多個位置,這些焊盤的某些部分與其他部分相同,這意味着例如我需要多次使用ProgramFilesFolder來處理不同的文件。但是現在,當我這樣做時,我會遇到一個錯誤。
我在做什麼錯?
謝謝,我已經保存該鏈接以供參考。在我讀過你的文章之前,我想到了如何添加Common文件夾。我將使用這段代碼執行一些測試,並檢查如何在Common Files中訪問子文件夾,因爲到目前爲止還沒有完成。爲每個結構創建一個片段到一個特定的地圖/位置是好的做法,還是應該將所有內容放在一個片段中? –
使用片段是很好的做法。但是您還必須將此片段保存在單獨的文件中以最大限度地利用它。 –
所以你說的是我需要爲每個片段添加一個安裝文件?芽我必須從這些文件引用Product.wxs(主文件)? –