具有用户选择目录的Wix File属性

时间:2017-04-27 23:47:17

标签: wix installer wix3

我正在尝试使用wix安装Windows服务,但我似乎无法将该服务的文件指向用户选择的安装目录。

<Component Id="MyServiceInstaller_ServiceControl" Guid="B72CAA3F-F2DB-48D2-90DD-061209AB2CE5" Directory="INSTALLDIR">
        <CreateFolder />
        <File Id='MyServiceEXE' Name='MyService.exe' DiskId='1' Source='[INSTALLDIR]MyService.exe'  KeyPath='yes'/>
        <ServiceInstall Id="MyServiceInstaller_ServiceInstall"
            Type="ownProcess"
            Vital="yes"
            Name="My Service"                    
            DisplayName="My Service"
            Description="This will make windows services great again!"
            Start="auto"
            Account="NT AUTHORITY\LocalService"
            ErrorControl="ignore"
            Interactive="no" />
        <ServiceControl Id="MyServiceInstaller_ServiceInstall" 
            Name="My Service"
            Stop="both"
            Remove="uninstall"
            Wait="yes" />               
    </Component>

问题似乎是当我使用任何[PROPERTY]目录时,我收到以下错误。

  

错误LGHT0103:系统找不到该文件   &#39; [INSTALLDIR] MyService.exe&#39;

如何告诉Wix使用用户选择的安装文件夹作为服务的路径?

1 个答案:

答案 0 :(得分:1)

File/@Source指向构建环境中的文件。 Component/@Directory告诉Windows Installer应该在哪里安装该文件。它控制用于安装和控制服务的文件。