devfunkd
devfunkd

Reputation: 3244

Wix File property with user selected directory

I am trying to install a windows service using wix but I can't seem to point the file for the service to the user selected install directory.

<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>

The issue seems to be when I use any [PROPERTY] directory I get the following error.

error LGHT0103 : The system cannot find the file '[INSTALLDIR]MyService.exe'.

How do I tell Wix to use the installation folder the user selected as the path for the service?

Upvotes: 0

Views: 165

Answers (1)

Bob Arnson
Bob Arnson

Reputation: 21896

File/@Source points to the file in your build environment. Component/@Directory tells Windows Installer where the file should be installed. That controls the file used to install and control the service.

Upvotes: 1

Related Questions