简体   繁体   English

Wix Burn:如何存储自定义InstallFolder以便以后进行修改?

[英]Wix Burn: How to store the custom InstallFolder for later modifications?

I'm trying to solve this for a while now. 我正在尝试解决这一问题。 I've authored a custom UI for my Bootstrapper Application. 我已经为Bootstrapper应用程序编写了一个自定义UI。 Setting a default value for InstallFolder is not the problem, but when the user changes this path, how can I store this path for later changes in add/remove programms, eg when another Package in the bundle should be installed by modifying the Bundle? 设置InstallFolder的默认值不是问题,但是当用户更改此路径时,如何存储此路径以供以后在添加/删除程序中进行更改,例如,应通过修改捆绑软件来安装捆绑软件中的另一个软件包? To write in the Registry could be an option, but the Bootstrapper Application doesn't run elevated all the time, so that it can't write to HKLM. 可以选择在注册表中进行写操作,但是Bootstrapper应用程序并不会一直运行,因此无法写到HKLM。 But there should be a way to do this, I saw similar things for Visual Studio... 但是应该有一种方法可以做到,我在Visual Studio中看到了类似的东西...

You should be storing the InstallFolder value in the registry in one (or all depending on how it is authored) of your MSIs that are packaged with the bootstrapper application. 您应该将BootStrapper应用程序打包的MSI之一(或全部取决于创建方式)中的注册表中存储InstallFolder值。 On startup you can use a util:RegistrySearch to look for and set the InstallFolder in the bootstrapper. 在启动时,您可以使用util:RegistrySearch在引导程序中查找并设置InstallFolder。

<Fragment>      
    <util:RegistrySearch
        Id="ServerInstalledCheck"
        Root="HKLM"
        Key="SOFTWARE\$(var.OEMRegistryRootKeyName)\v7"
        Value="ServerPath"
        Result="value"
        Variable="ServerInstalled"/>
    <util:DirectorySearch
        Path='[ServerInstalled]'
        Variable='InstallFolder'
        After='ServerInstalledCheck'
        Condition='ServerInstalled' />
</Fragment>

I think you can directly set the variable InstallFolder in the registry search itself and omit the DirectorySearch. 我认为您可以在注册表搜索本身中直接设置变量InstallFolder并省略DirectorySearch。 The DirectorySearch approach was used just to ensure we only set the InstallFolder to a location that actually exists on the machine. DirectorySearch方法仅用于确保我们仅将InstallFolder设置为计算机上实际存在的位置。 There may be other advantages as well but I can't think of them at the moment. 也许还有其他优势,但我暂时无法想到。

This will retain your default InstallFolder location on a fresh install and 'remember' the selected install location when running to uninstall/modify/upgrade. 这将在全新安装中保留您的默认InstallFolder位置,并在运行以卸载/修改/升级时“记住”所选的安装位置。

You are right that you cannot rely on writing any registry keys inside your bootstrapper application because it is not guaranteed (and really shouldn't be) run elevated. 没错,您不能依靠自己在引导程序中编写任何注册表项,因为不能保证(而且实际上不应该)提升注册表项。


This is basically following the 'remember property' pattern which is explained here . 这基本上是以下这解释了“记住物业”模式在这里 Whenever you want to remember a value set in a previous install during modify/upgrade/removal, this is generally the go to. 每当您想在修改/升级/删除过程中记住上一次安装中设置的值时,通常都可以这样做。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM