WIX工具集bundle获取从ComponentSearch返回的路径的父目录



如果已经安装了早期版本,我将尝试让我的WIX捆绑包使用以前的安装目录。以前的版本没有为安装位置创建注册表项。因此,我尝试使用ComponentSearch(Util扩展(来查找主可执行文件。安装目录是包含可执行文件的目录的父目录。ComponentSearch提供了C:\InstallDirectory\DirectoryContainerEXE目录。如何获取C:\InstallDirectory?

<?xml version="1.0" encoding="utf-8"?>
<Include xmlns="http://schemas.microsoft.com/wix/2006/wi"
xmlns:util="http://schemas.microsoft.com/wix/UtilExtension"
xmlns:bal="http://schemas.microsoft.com/wix/BalExtension">
<Fragment>
<util:ComponentSearch Id="ExeComponentSearch" Guid="{COMPONENT GUID}" Result="directory" Variable="InstallFolder"/>
</Fragment>
</Include>

我找到了一个解决方案。显而易见的解决方案是使用父级为C:\InstallDirectory的文件。因为我在C:|InstallDirectory中没有任何无法工作的文件。我所拥有的是一个在C:\InstallDirectory上设置权限的组件。我使用该组件来获取目录。这可能适用于不包含文件的其他类型的组件。也许是作为组件关键路径的注册表?

<util:ComponentSearch Id="InstallDirectoryPermissionsSearch" Guid="{COMPONENT GUID}" Result="directory"  Variable="InstallFolder"/>

最新更新