首页 文章

WiX安装程序:一个msi可以使用 - 一个Windows应用程序和一个使用WiX的Windows服务

提问于
浏览
2

我为使用Wix工具集创建了两个单独的msi:

  • Windows应用程序
  • Windows服务

目标

想拥有一个可以同时安装的msi:

  • Windows应用程序
  • Windows服务

问题

是否可以使用WiX?
我们可以使用合并模块将msi包含在一个msm中吗?如果有,怎么样?

编辑1

得到错误 -

ID为“TARGETDIR_WindowsService”的目录不是有效的根目录 . 每个产品或模块可能只有一个根目录,其Id属性值必须为“TARGETDIR”,其Name属性值必须为“SourceDir”

如果我没有更改TARGETDIR,那么“TARGETDIR”和“ProgramFilesFolder”都会出现重复错误 .

1 回答

  • 2

    是的你可以 . 你把它们放在不同的功能 . 然后,您可以构建UI以启动应用程序安装,服务安装或两者 .

    <?xml version="1.0" encoding="UTF-8"?>
    <Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
        <Product Id="*" Name="SetupProject1" Language="1033" Version="1.0.0.0" Manufacturer="YourCompany" UpgradeCode="3fdc2c3a-72f3-4a5f-a182-3905272bf888">
            <Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />
    
            <MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
            <MediaTemplate />
    
            <Feature Id="ProductFeature" Title="My Application" Level="1">
                <ComponentGroupRef Id="ProductComponents" />
            </Feature>
            <Feature Id="ServiceFeature" Title="My Service" Level="1">
                <ComponentGroupRef Id="ProductComponents" />
            </Feature>
        </Product>
    
        <Fragment>
            <Directory Id="TARGETDIR" Name="SourceDir">
                <Directory Id="ProgramFilesFolder">
                    <Directory Id="INSTALLFOLDER" Name="MyApplication" />
                    <Directory Id="SERVICEFOLDER" Name="MyService" />
                </Directory>
            </Directory>
        </Fragment>
    
        <Fragment>
            <ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
            </ComponentGroup>
            <ComponentGroup Id="ServiceComponents" Directory="SERVICEFOLDER">
            </ComponentGroup>
        </Fragment>
    </Wix>
    

相关问题