Example of Installation

This is a short tutorial which explain you how to install a universal windows service inside your own C# software package.

We want to install a service which must be manually started and runs different applications like the notepad every 20 minutes for example.

Download files

Firstly you have to download the latest version. Therefore you would only need the binaries of UWS package.

After downloading the packed file you must extract the binaries into a directory you want. Should be someone inside your installation directories.

Install UWS

Before you could use the installation class you have to copy the files to their working directory or installation destination because the installation class uses the current path of assembly for service installation. Also you have to leave the whole UWS files together in one directory.

Now you have to add the following code to your C# installation program. The following includes are neeeded.


This code example is a part of the installation routine which installs the service with given name, description and so on. Errors would be recorded in the multi line text box 'txtStatus'.

Install Method

And now a simple code example for uninstalling the universal windows service.

Uninstall Method

For all possible properties of the installer class see the SDK Reference.

Configure the service

After you have installed your software package and the UWS you have to generate a so called configuration file for the service to tell the UWS what he should do. This file must be a xml file with the following content.

	<!-- settings of the logging (using log4net) - see log4net documentation for further information -->
		<appender name="File" type="log4net.Appender.FileAppender">
			<file value="uws.log"/>
			<appendToFile value="true"/>
			<layout type="log4net.Layout.PatternLayout">
				<conversionPattern value="%date [%thread] %-5level %logger - %message%newline"/>
		<logger name="uws">
			<level value="ALL"/>
			<appender-ref ref="File"/>
		</logger name="Notepad">
			<level value="ALL"/>
			<appender-ref ref="File"/>
	<!-- configuration of the universal windows service by itself -->
	<application name="Notepad" enabled="true">
			<path value="c:\winnt\notepad.exe"/>
			<trigger type="uws.Triggers.IntervalTrigger">
				<minutes value="20"/>

Now save this text file in the installation directory of your software package where the binary files of the UWS are. The file must have the name of our service which here would be uniserv.config.

After that you could start the UWS service by clicking the start button at the windows service management dialog shown below

Start Service

Now every 20 minutes a notepad would be started until you stop the service or reboot. Try it!