The ServiceInstall element comes with a set of mandatory attributes that I'm listing below:. After defining our ServiceInstall element, we can set the corresponding ServiceControl element. Just like ServiceInstall, the ServiceControl element comes with a set of mandatory attributes:. Additionally, we can now go and define the ServiceConfig element to configure our Windows Service.
The major upgrade element defines the behavior of the installer when performing an upgrade. The media template element describes how media is packaged up for the installer. By default the element has no attributes. In this section we have created a fragment that defines where our service will be installed.
In the next 3 sections we will define each file that needs to be included in our installer. In WiX, Components are used to define the units that need to be installed. While it is possible for a single component to contain multiple files, it is recommended to create a component for each file that needs to be installed. It is not required to group components. The dependency files need to be overwritten every time an install is performed and removed when the service is uninstalled.
In the Dependency Files component group I created a component for each dependency dll containing a single File element with the following attributes. For my project the config files need to remain unchanged on upgrades and remain on the machine on uninstalls so that any changes made manually do not get overwritten or lost.
All the attributes used to create the Dependancy File Components are exactly the same except the following Component attributes. The service group contains a single component that defines the Windows Service file, installs the service, and starts the service. The final element is the Feature element. This element ties all the component groups together and tells windows to install them. By default, the installer project is not set to build with the rest of the solution so it will not be built by the main build commands in the VS menus.
To build the installer, right click the installer project and select build. To run the installer, just double click it. Once the install completes you should see all the files in the install directory and the service running in the services menu. Installed Files. When uninstalled successfully, you will see the service removed from the service menu and all the files removed from the install directory except the config files.
This was just a quick example of what can be done with the WiX Toolset. It can be used to do much more such as custom UIs, installing databases, setting registry entries, etc. I recommend visiting wixtoolset. How can I install a windows service with WiX? I already did everything on the setup to install a normal. Do I only need to copy this in my product. I want to install it via the Setup and set the Service to autostart on Windows Startup.
And I want to delete the Service with the Setup mean it will stop the Service and uninstall it. It would be great to if I can update the Service too with a new Setup mean it will stop the Service, uninstall it, install the new one and start it. Is all this possible with the Code from the answere I linked? You can normally get away with fewer constructs.
Documentation : ServiceInstall , ServiceControl. How are we doing? Please help us improve Stack Overflow. Since Visual Studio , the traditional Windows setup project has been removed. The main difference to the old Visual Studio setup projects, is with WiX, there is no user interface, and everything is configured using XML files. This increases the power and flexibility of your setup projects. You can find a link to the latest download on the WiX Toolset website.
You should now have a setup project with a single Product. Next, we need to add a reference to the TestService project. Adding a project reference to TestService , ensures the TestService. It also generates a set of WiX preprocessor definitions that are required when configuring the Product. Also, you can find much more detailed documentation on each of the elements on the WiX Toolset website.
What I will say, is if you use this Product. You will also need to change wherever it says var.
0コメント