Search code examples
wixsharp

Can I install a Windows Service with Wixsharp


I've been working with WIX# (wixsharp) for creating an MSI and I can't see how to install a windows service. I've gone through the whole CHM file but I'm not seeing anything specific for Windows Services.

TIA,

Brent...


Solution

  • As of version 1.0.4 (released 2015-01-18), WiX# supports installation of Windows services.

    https://wixsharp.codeplex.com/releases/view/610843

    File service;
    var project =
        new Project("My Product",
            new Dir(@"%ProgramFiles%\My Company\My Product",
                service = new File(@"..\SimpleService\MyApp.exe")));
    
    service.ServiceInstaller = new ServiceInstaller
    {
        Name = "WixSharp.TestSvc",
        StartOn = SvcEvent.Install,
        StopOn = SvcEvent.InstallUninstall_Wait,
        RemoveOn = SvcEvent.Uninstall_Wait,
    };