gpt4 book ai didi

wix - WiX将文件添加到目录组件

转载 作者:行者123 更新时间:2023-12-04 01:54:34 28 4
gpt4 key购买 nike

我参与了WiX,添加注册表项的工作正常,所以添加文件时遇到了麻烦。

我得到错误:

Found orphaned Component 'ProductComponent'.  
If this is a Product, every Component must have at least one parent Feature.
To include a Component in a Module, you must include it directly as a
Component element of the Module element or indirectly via ComponentRef,
ComponentGroup, or ComponentGroupRef elements.


工作的代码:

<Fragment>
<Directory Id="TARGETDIR" Name="SourceDir">

<Directory Id="ProgramFilesFolder">
<Directory Id="INSTALLFOLDER" Name="ChrisExcelAddintest" />

<Component Id="Registry_FriendlyName">
<RegistryValue Id="RegKey_FriendlyName" Root="HKCU"
Key="Software\Microsoft\Office\Excel\AddIns\ExcelAddIn1test"
Name="ChrisFriendlyName"
Value="My Excel Add-In"
Type="string" KeyPath="yes" />
</Component>
<Component Id="Registry_Description">
<RegistryValue Id="RegKey_Description" Root="HKCU"
Key="Software\Microsoft\Office\Excel\AddIns\ExcelAddIn1test"
Name="Description"
Value="Chris Excel Add-In"
Type="string" KeyPath="yes" />
</Component>
<Component Id="Registry_Manifest">
<RegistryValue Id="RegKey_Manifest" Root="HKCU"
Key="Software\Microsoft\Office\Excel\AddIns\ExcelAddIn1test"
Name="Manifest" Value="[INSTALLFOLDER]ExcelAddIn1test.vsto|vstolocal"
Type="string" KeyPath="yes" />
</Component>
<Component Id="Registry_LoadBehavior">
<RegistryValue Id="RegKey_LoadBehavior" Root="HKCU"
Key="Software\Microsoft\Office\Excel\AddIns\ExcelAddIn1test"
Name="LoadBehavior" Value="3"
Type="integer" KeyPath="yes" />
</Component>
</Directory>
</Directory>
</Fragment>


但是我尝试只添加以下代码

 <Directory Id="TARGETDIR" Name="SourceDir">


这段代码:

 <Directory Id="ProgramMenuFolder">
<Directory Id="installcalc">
<Component Id="ProductComponent" Guid="b11556a2-e066-4393-af5c-9c9210187eb2">
<File Id="Calc" DiskId="1" Source="C:\WINDOWS\system32\calc.exe"/>
</Component>
</Directory>
</Directory>

最佳答案

您需要将组件添加到“功能”部分

例如

<Feature Id="ProductFeature" Title="yourtitle" Level="1">
EXISTING ENTRIES HERE, Your new entry below
<ComponentRef Id="ProductComponent2"/>
</Feature>

关于wix - WiX将文件添加到目录组件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16867104/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com