基于模块的软件设置

Setup for module based Software

我开发了一个分为两部分的 Modulebase Software
第一部分是 Service(BaseSoftware),第二部分是可以添加到此服务的 some Modules

现在状态:
我已经为服务 (BaseSoftware) 创建了一个 Wix 安装程序。但是现在我需要安装模块。每个模块都应该有自己的 MSI 设置。

问题:
在我安装模块之前,必须先安装 BaseSoftware。

解法:
我想我可以在模块设置中进行自定义操作,询问系统是否已安装 BaseSoftware。如果不只是启动 BaseSoftware 的安装程序,然后继续模块安装程序。

但我真的不知道什么是最佳实践。

在您的服务安装程序中,写入一个表明您的服务已安装的注册表值 - 这里是一个将安装目录写入注册表的示例(您应该自定义密钥)

    <Component Id="ServiceRegistryKeys" Directory="InstallLocation" Permanent='yes'>
        <RegistryKey Root="HKLM" Key="SOFTWARE\My Company\My Service">
            <RegistryValue Type="string" Name="InstallPath" Value="[INSTALLDIR]" KeyPath="yes" />
        </RegistryKey>
    </Component>

在模块安装程序中,您可以检查该密钥,如果不存在则失败:

    <!-- Require Service to be installed already -->
    <Property Id="SERVICEPATH">
        <RegistrySearch Id="ServicePath" Root="HKLM" Key="SOFTWARE\My Company\My Service" Name="InstallPath" Type="raw" />
    </Property>
    <Condition Message='The Service is not installed. Please install the Service first, and then this module.'><![CDATA[Installed OR (SERVICEPATH <> "")]]></Condition>

确保您使用相同的注册表项