【发布时间】:2020-07-27 13:26:31
【问题描述】:
对于我的应用程序,大部分文件需要安装到 ProgramFiles 的目录中,另外一个文件需要安装在 AppData/Local 的目录中。
这是我目前所拥有的一个例子:
<Fragment>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="INSTALLFOLDER" Name="Folder1" />
</Directory>
</Directory>
</Fragment>
<Fragment>
<ComponentGroup Id="AppID" Directory="INSTALLFOLDER">
<Component Id="AppID">
<File Source="$(var.myApp.TargetPath)" />
</Component>
<Component Id="OtherFile" Guid="INSERT-GUID_HERE">
<File Id='OtherFile' Name='OtherFile' Source="otherfile" KeyPath='yes' />
</Component>
<Component Id="CopyId">
<CopyFile Id="CopyId" FileId="OtherFile"
DestinationDirectory="LocalAppDataFolder" />
</Component>
</Fragment>
我尝试将另一个文件复制到 AppData/Local,但这不会编译并给出错误:
Unresolved reference to symbol 'Directory:LocalAppDataFolder' in section 'Fragment:'
理想情况下,我希望其他文件位于 AppData/Local 的目录中,而不是 ProgramFiles 中。
【问题讨论】:
-
您得到的编译错误是因为您的 Directory XML 节点中没有对目标目录的引用。
标签: windows wix windows-installer