Book Image

WiX Cookbook

By : Nicholas Matthew Ramirez
1 (1)
Book Image

WiX Cookbook

1 (1)
By: Nicholas Matthew Ramirez

Overview of this book

Table of Contents (20 chapters)
WiX Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Adding a new user with the log on as a service security setting


When you develop a Windows service and you want it to start automatically when the computer is turned on, you'll need to run that service as a user that has the Log on as a service security setting. In this recipe, you will learn how to apply this attribute to a new user account that we will create.

Getting ready

To prepare for this recipe, create a new setup project and call it LogonAsServiceInstaller.

How to do it...

Add the LogonAsService attribute to the User element, as outlined in the following steps:

  1. Add UtilExtension to the project by right-clicking on the References node in Solution Explorer and going to Add Reference... | WixUtilExtension.dll | Add | OK.

  2. Add the UtilExtension namespace to the Wix element:

    <Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
    xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
  3. Add a User element within a component and set its Name attribute to the name of the new user you'd like...