The following is a lightweight template that allows you to create an installer for your Windows Service and dependent files. The following assumes that the WiX Toolset v3.7 is installed on the development machine. First, do the following to your application project:
- Right click in the design window for your class, and select “Add Installer”.
Then, create your setup project:
- To your solution, add a new Wix Setup Project.
- Add a reference to your service application project.
- Add references to WixNetFxExtension.dll and WixUIExtension.dll from C:\Program Files (x86)\WiX Toolset v3.7\bin\
The template follows. Replace instances of
MyProduct with your product name, and MyCompany with your company name.<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Name="MyCompany MyProduct"
Id="*"
UpgradeCode="{INSERT-A-NEW-AND-UNIQUE-GUID-HERE}"
Manufacturer="My Company"
Version="!(bind.FileVersion.MyProduct.exe)"
Language="1033">
<Package InstallerVersion="200"
Compressed="yes" />
<Media Id="1"
Cabinet="media1.cab"
EmbedCab="yes" />
<Directory Id="TARGETDIR"
Name="SourceDir">
<Directory Id="INSTALLDIR"
Name="PFiles">
<Directory Id="MyCompany"
Name="MyCompany">
<Directory Id="MyProduct"
Name="MyProduct">
<Component Id="MyCompany.MyProduct"
Guid="{INSERT-A-NEW-AND-UNIQUE-GUID-HERE}">
<File Id="MyProduct.exe"
Name="MyProduct.exe"
Source="..\MyProduct\bin\Release\MyProduct.exe"
Vital="yes"
KeyPath="yes"
DiskId="1" />
<File Id="MyProduct.exe.config"
Name="MyProduct.exe.config"
Source="..\MyProduct\bin\Release\MyProduct.exe.config"
Vital="yes"
KeyPath="no"
DiskId="1" />
<ServiceInstall Id="ServiceInstaller"
Type="ownProcess"
Vital="yes"
Name="MyCompany:MyProduct"
DisplayName="MyCompany:MyProduct"
Description="My Product Description"
Start="auto"
Account="LocalSystem"
ErrorControl="ignore"
Interactive="no" />
<ServiceControl Id="StartService"
Start="install"
Stop="both"
Remove="uninstall"
Name="MyCompany:MyProduct"
Wait="yes" />
</Component>
</Directory>
</Directory>
</Directory>
</Directory>
<Feature Id="ProductFeature"
Title="MyCompany:MyProduct"
Level="1">
<ComponentRef Id="MyCompany.MyProduct" />
</Feature>
</Product>
</Wix>
Không có nhận xét nào:
Đăng nhận xét