Skip to content

Commit c89caf9

Browse files
committed
fix(nsis): Add allowServiceToInstall nsis option for update by window service
If window service needs to run installer for update, the installer must have admin previlege.
1 parent 85a3e55 commit c89caf9

File tree

3 files changed

+15
-1
lines changed

3 files changed

+15
-1
lines changed

.changeset/poor-windows-heal.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"app-builder-lib": patch
3+
---
4+
5+
Set isAdminRightsRequired option true regardless of oneClick option

packages/app-builder-lib/src/targets/nsis/NsisTarget.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -159,9 +159,12 @@ export class NsisTarget extends Target {
159159
.join(", "),
160160
}
161161
const isPerMachine = options.perMachine === true
162+
const allowServiceToInstall = options.allowServiceToInstall !== false
163+
162164
if (!this.isPortable) {
163165
logFields.oneClick = oneClick
164166
logFields.perMachine = isPerMachine
167+
logFields.allowServiceToInstall = allowServiceToInstall
165168
}
166169

167170
await packager.info.callArtifactBuildStarted(
@@ -319,7 +322,7 @@ export class NsisTarget extends Target {
319322
updateInfo = await createBlockmap(installerPath, this, packager, safeArtifactName)
320323
}
321324

322-
if (updateInfo != null && isPerMachine && oneClick) {
325+
if ((updateInfo != null && isPerMachine && oneClick) || allowServiceToInstall) {
323326
updateInfo.isAdminRightsRequired = true
324327
}
325328

packages/app-builder-lib/src/targets/nsis/nsisOptions.ts

+6
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,12 @@ export interface NsisOptions extends CommonNsisOptions, CommonWindowsInstallerCo
8686
*/
8787
readonly allowToChangeInstallationDirectory?: boolean
8888

89+
/**
90+
* *Whether to allow window servie to install for update.
91+
* @default false
92+
*/
93+
readonly allowServiceToInstall?: boolean
94+
8995
/**
9096
* The path to installer icon, relative to the [build resources](/configuration/configuration#MetadataDirectories-buildResources) or to the project directory.
9197
* Defaults to `build/installerIcon.ico` or application icon.

0 commit comments

Comments
 (0)