将heat.exe用于放置在WindowsVolume中的文件-GUID问题 [英] Using heat.exe for files placed in WindowsVolume - GUID Issues

查看:141
本文介绍了将heat.exe用于放置在WindowsVolume中的文件-GUID问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在SO和Google上进行了一段时间的搜索,但没有找到相关的问题.因此,希望这个问题不会重复.

I searched some time on SO and Google but I didn't find related questions. So hopefully this issue isn't a duplicate.

对于我的一个客户,我正在使用WiX创建安装程序工件.某些文件已安装到

For a customer of mine I'm creating installer artifacts with WiX. Some files are installed to

[WindowsVolume]\tool\scripts. 

那很好,只要我手动将这些文件添加到相应的WiX片段中即可.由于该组件的文件最近经常被移动和删除,因此我决定通过subversion通过heat.exe来获取它们.我面临的一个问题是,热量的-ag开关拒绝在[WindowsVolume]上运行-我猜是因为-ag可以使GUID保持静态,只要组件目录的路径保持不变.因此,我在每次加热期间都使用-gg生成了新的GUID.测试人员现在报告文件没有被替换,并且有时根本没有创建该文件夹.

That went fine as long as I manually added those files to the according WiX fragment. Since files of this component are being moved and removed pretty often lately I decided to fetch them via heat.exe from subversion. A problem I'm facing is, that heat's -ag switch refuses to work on [WindowsVolume] - I guess because -ag keeps the GUIDs static as long as the path to the Component's directory stays the same. Therefore I used -gg to generate new GUIDs during each run of heat. Testers are now reporting that files weren't replaced and the folder doesn't get created at all sometimes.

通过设置-ag开关使用自动生成的GUID,我从灯光中收到以下错误消息:

Using autogenerated GUIDs by setting -ag switch I get the following error message from light:

C:\checkouts\project\Setup\tool.fragment.wxs(41,0): error LGHT0231: 
The component 'cmpF69984FE7B4A36DD402E57B30E416ACB' has a key file with path 
'TARGETDIR\indexes\arbitrary.file'.  Since this path is not rooted in one of 
the standard directories (like ProgramFilesFolder), this component does not 
fit the criteria for having an automatically generated guid.  (This error may 
also occur if a path contains a likely standard directory such as nesting a 
directory with name "Common Files" under ProgramFilesFolder.)

在WiX中,我有一个主要的.wxs来定义文件夹,功能和InstallExecuteSequence.相关的文件夹定义为:

In WiX I've got a main .wxs defining folders, features and the InstallExecuteSequence. The relevant folder definition is:

<Directory Id="TARGETDIR" Name="SourceDir">
  <Directory Id="ToolFolder">
    <Directory Id="ToolScriptsFolder" Name="scripts"/>
  </Directory>
</Directory>

<SetDirectory Id="ToolFolder" Value="[WindowsVolume]tool" />

收获的碎片是:

<?xml version="1.0" encoding="utf-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
  <Fragment>
    <DirectoryRef Id="ToolScriptsFolder" />
  </Fragment>

  <Fragment>
    <ComponentGroup Id="CG_ToolScripts">
        <Component Id="cmp2BCA6A75C5C234BEF6FAD9FC41C4B661" 
                   Directory="ToolScriptsFolder" Guid="*">
            <File Id="fil8C1ADEFF76E859B93A97C72A95365E90" 
                  KeyPath="yes" Source="$(var.ToolScripts)\arbitrary.file" />
        </Component>
    </ComponentGroup>
  </Fragment>
</Wix>

有人知道如何在不将工具\脚本移动到[ProgramFiles]的情况下使自动生成的GUID正常工作吗?感谢您使我免于手动编辑片段的任何帮助:)预先感谢!

Any idea how to get automatic generated GUIDs working without moving tools\scripts to [ProgramFiles]? Any help that relieves me from manually editing the fragment is appreciated :) Thanks in advance!

推荐答案

由于我没有找到解决办法,因此我实施了一种解决方法.以防万一将来有人偶然发现类似问题,这就是窍门:

Since I didn't find a solution for this I implemented a workaround. Just in case anyone stumbles upon a similar issue in the future, here's what did the trick:

  1. 检查注册表以查找先前安装的脚本目录
  2. 添加 RemoveFolderEx 自定义操作,以删除写入的目录在先前的安装过程中进行注册
  3. 将脚本目录写入注册表,以在下一次安装期间进一步使用
  1. checking registry for the scripts' directory installed by a prior installation
  2. adding a RemoveFolderEx custom action to remove the directory written to registry during a prior installation
  3. writing the scripts' directory to registry for further use during the next installation

在代码中,它看起来像:

In code it looks somewhat like:

<Property Id="LAST_KNOWN_SCRIPTS_LOCATION">
  <RegistrySearch Key="SOFTWARE\vendor\product" Root="HKLM" Type="raw" Id="APPLICATIONFOLDER_REGSEARCH" Name="scriptsLocation" />
</Property>

<SetProperty Id="LAST_KNOWN_SCRIPTS_LOCATION" Value="some\default\directory" Before="AppSearch"><![CDATA[LAST_KNOWN_SCRIPTS_LOCATION]]></SetProperty>

<DirectoryRef Id="ToolScriptsFolder">
  <Component Id="cmp2EB940FB7EFA4691AD58C7AE293A529E" Guid="ED4252705A824BD19441C5574CC99E67">
    <RegistryValue Root="HKLM" Key="SOFTWARE\vendor\product\scriptsLocation" Value="[ToolScriptsFolder]" Type="string" KeyPath="yes"/>
    <util:RemoveFolderEx Id="rmfx_ScriptsFolder" On="both" Property="LAST_KNOWN_SCRIPTS_LOCATION"/>
  </Component>
</DirectoryRef>

这篇关于将heat.exe用于放置在WindowsVolume中的文件-GUID问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆