Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,15 @@
<MajorUpgrade DowngradeErrorMessage="A later version of [ProductName] is already installed. Setup will now exit." />

<!-- Define the directory structure -->
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<StandardDirectory Id="ProgramFiles6432Folder">

<!-- Create a folder inside program files -->
<Directory Id="ROOTDIRECTORY" Name="$(var.Manufacturer)">
<!-- Create a folder inside program files -->
<Directory Id="ROOTDIRECTORY" Name="$(var.Manufacturer)">

<!-- Create a folder within the parent folder given the name -->
<Directory Id="INSTALLFOLDER" Name="$(Name)" />
</Directory>
<!-- Create a folder within the parent folder given the name -->
<Directory Id="INSTALLFOLDER" Name="$(Name)" />
</Directory>
</Directory>
</StandardDirectory>

<!-- The files inside this DirectoryRef are linked to
the App.WindowsService directory via INSTALLFOLDER -->
Expand All @@ -52,6 +50,7 @@
DisplayName="$(Name)"
Description="A joke service that periodically logs nerdy humor."
Start="auto"
Account="LocalService"
ErrorControl="normal" />

<!-- Tell WiX to start the Service -->
Expand Down
9 changes: 8 additions & 1 deletion docs/core/extensions/windows-service-with-installer.md
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ After the project reference has been added, configure the _Package.wxs_ file. Op
<MajorUpgrade DowngradeErrorMessage="A later version of [ProductName] is already installed. Setup will now exit." />

<!-- Define the directory structure -->
<StandardDirectory Id="ProgramFiles64Folder">
<StandardDirectory Id="ProgramFiles6432Folder">

<!-- Create a folder inside program files -->
<Directory Id="ROOTDIRECTORY" Name="$(var.Manufacturer)">
Expand Down Expand Up @@ -219,6 +219,7 @@ After the project reference has been added, configure the _Package.wxs_ file. Op
DisplayName="$(Name)"
Description="A joke service that periodically logs nerdy humor."
Start="auto"
Account="LocalService"
ErrorControl="normal" />

<!-- Tell WiX to start the Service -->
Expand All @@ -240,6 +241,12 @@ After the project reference has been added, configure the _Package.wxs_ file. Op
</Wix>
```

The `ServiceInstall` element's `Account` attribute specifies the account under which the service runs. The `LocalService` account is a built-in account with reduced privileges that's appropriate for most services. Common values include:

- `LocalService`: A built-in account with reduced privileges and no network credentials.
- `NetworkService`: Similar to LocalService but has network credentials.
- `LocalSystem`: The highest privilege level (use with caution).

When you build the project, the output is an MSI file that can be used to install and uninstall the service.

# [Microsoft installer extension](#tab/ext)
Expand Down