我试图RemoveFolderEx
在卸载应用程序时从我的安装文件夹中删除一个上一级的文件夹。这是我所拥有的,但它不起作用:
<Fragment>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="MyAppBaseFolder" Name="MyAppID">
<Directory Id="INSTALLFOLDER" Name="MyAppLauncher">
<Directory Id="UPDATESCRIPTSFOLDER" Name="Scripts" />
<Component Id="CleanupMainApplicationFolder" Guid="*">
<RegistryValue Root="HKLM" Key="SOFTWARE\MyApp ID\MyApp ID Windows Client" Name="Path" Type="string" Value="${path::getfullpath(path::combine([INSTALLFOLDER],'..\MyApp'))}" KeyPath="yes" />
<util:RemoveFolderEx On="uninstall" Property="APPLICATIONFOLDER" />
</Component>
</Directory>
</Directory>
</Directory>
<Directory Id="ProgramMenuFolder">
<Directory Id="ApplicationProgramsFolder" Name="MyApp ID"/>
</Directory>
</Directory>
</Fragment>
MSI 会构建得很好,但是当我运行设置时,它似乎在RegistryValue
元素上失败并抱怨路径中的“..”。我正在制作的字符串就像:"C:\Program Files (X86)\MyApp ID\MyAppLauncher\..\MyApp"
. 我需要它来解决:"C:\Program Files (X86)\MyApp ID\MyApp"
.
我对这些${path:: ... }
东西不太熟悉。我看到了几个例子,${path::combine()}
所以我想我认为这可以getfullpath
在 .NET 中使用。也许确实如此,我的语法是错误的?
谢谢!
编辑:对不起,我${path::combine...
从BUILDING WIX得到了这些东西,但没有完全阅读那篇文章在做什么。它与 wxs 文件无关,它用于 NAnt(如下所述的 Rob)。所以我想我的问题很简单:我如何组合和解析绝对路径和相对路径,如C:\Program files (X86)\MyApp ID\MyAppLauncher\..\MyApp
. 谢谢
EDIT2:再次感谢 Rob,我非常专注于解决我什至没有考虑过最明显的解决方案的路径,即简单地引用一个新<Directory
元素。我现在使用以下代码清理 2 个文件夹:
<Property Id="APPLICATIONFOLDER">
<RegistrySearch Key="SOFTWARE\MyApp ID\MyApp ID Windows Client" Root="HKLM" Type="raw" Id="APPLICATIONFOLDER_REGSEARCH" Name="Path" />
</Property>
<Property Id="PRINTERFOLDER">
<RegistrySearch Key="SOFTWARE\MyApp ID\MyApp ID Printer" Root="HKLM" Type="raw" Id="PRINTERFOLDER_REGSEARCH" Name="Path" />
</Property>
...
<Fragment>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="MyAppBaseFolder" Name="MyAppID">
<Directory Id="INSTALLFOLDER" Name="MyAppLauncher">
<Directory Id="UPDATESCRIPTSFOLDER" Name="Scripts" />
<Component Id="CleanupMainApplicationFolder" Guid="*">
<RegistryValue Root="HKLM" Key="SOFTWARE\MyApp ID\MyApp ID Windows Client" Name="Path" Type="string" Value="[LM_INSTALLFOLDER]" KeyPath="yes" />
<util:RemoveFolderEx On="uninstall" Property="APPLICATIONFOLDER" />
<RegistryValue Root="HKLM" Key="SOFTWARE\MyApp ID\MyApp ID Printer" Name="Path" Type="string" Value="[LMP_INSTALLFOLDER]" />
<util:RemoveFolderEx On="uninstall" Property="PRINTERFOLDER" />
</Component>
</Directory>
<Directory Id="LM_INSTALLFOLDER" Name="MyApp" >
</Directory>
<Directory Id="LMP_INSTALLFOLDER" Name="MyAppPrinter" >
</Directory>
</Directory>
</Directory>
<Directory Id="ProgramMenuFolder">
<Directory Id="ApplicationProgramsFolder" Name="MyApp ID"/>
</Directory>
</Directory>
</Fragment>