Skip to content

Windows installer: add per-user install option (no elevation) - #18167

Merged
gtritchie merged 26 commits into
mainfrom
feature/windows-per-user-install
Jul 9, 2026
Merged

gtritchie merged 26 commits into
mainfrom
feature/windows-per-user-install

Conversation

@gtritchie

@gtritchie gtritchie commented Jul 7, 2026 •

Copy link
Copy Markdown
Member

Summary

Adds an install-mode choice to the RStudio Windows (NSIS) installer: All users (the default, installed to C:\Program Files\RStudio with an elevation prompt) or Just me (the current user, installed to %LOCALAPPDATA%\Programs\RStudio with no elevation). A current-user install requires no administrator rights, and uninstalling one no longer prompts for elevation or leaves behind its Start Menu shortcut and registry entries.

This is built on the NsisMultiUser framework (with the UAC and StdUtils NSIS plugins), which presents the mode page, elevates on demand only for all-users installs, and records the chosen mode so the uninstaller reproduces it.

Closes #14122.
Closes #1634.

Changes

  • Vendor the NsisMultiUser framework (plus the UAC and StdUtils NSIS plugins) as a Windows build dependency, fetched from the build-tools mirror; add dependencies/tools/upload-nsis-multiuser.sh to publish the pinned bundle.
  • Add the install-mode page and on-demand elevation. The installer no longer forces elevation for a current-user install.
  • Write the installer's registry entries (App Paths, file associations, uninstall keys) to the shell context, so a per-user install writes to HKCU instead of HKLM. All-users behavior is unchanged.
  • Reproduce the recorded install mode in the uninstaller: a current-user uninstall runs unelevated and removes its files, Start Menu shortcut, and registry entries.
  • Remove the non-functional InstallOptions PATH/desktop-icon page (its INI was never extracted, so the page rendered empty).
  • Do not set a static InstallDir: NsisMultiUser treats a non-empty $INSTDIR at init as a /D argument, which otherwise pinned both modes to Program Files.
  • Fix a pre-existing .Rtex file-association bug encountered in the same file (a duplicate write, and an uninstall that removed the wrong ProgID value).
  • Update NEWS.md, and NOTICE for the bundled plugins (NsisMultiUser MIT, UAC zlib/libpng, StdUtils LGPL-2.1, nsProcess zlib/libpng).

Screenshots

screenshot of first installer screen showing prompt for per-user or all-user install choice Screenshot of installer screen after choosing to install for current user screenshot of installer screen showing default destination for current user install screenshot of installer screen showing details on updating an existing per-user install

Testing

Built the installer on Windows and exercised both modes end to end:

  • Current-user: installs to %LOCALAPPDATA%\Programs\RStudio with no elevation prompt, RStudio launches, uninstalls cleanly.
  • All-users: installs to C:\Program Files\RStudio with one elevation prompt, RStudio launches, uninstalls cleanly.

A makensis compile-smoke of the installer and uninstaller integration passes. There is no automated installer test suite, so the above was manual. Silent-mode switches (/S /currentuser, /S /allusers), cross-mode coexistence, and upgrade-over-previous were not exercised.

gtritchie added 12 commits June 26, 2026 14:40
Remove the static InstallDir. NsisMultiUser treats a non-empty $INSTDIR at
MULTIUSER_INIT time as a /D command-line argument and pins both install modes
to it, so the static InstallDir forced per-user installs into
C:\Program Files\RStudio (requiring elevation) instead of
%LOCALAPPDATA%\Programs\RStudio. The framework now sets $INSTDIR per mode:
$PROGRAMFILES64\RStudio for all-users, %LOCALAPPDATA%\Programs\RStudio for
per-user.
Downloads Drizin/NsisMultiUser at the pinned commit, verifies the expected
Include/ + Plugins/ layout, repackages it into NsisMultiUser.zip (rooted so it
extracts straight into dependencies/windows/nsis-multiuser/<version>/), and
uploads to the rstudio-buildtools S3 bucket that install-dependencies.cmd
fetches from. Follows the existing upload-*.sh pattern; archives via Python for
a deterministic, portable build (git-bash lacks zip).
The Windows installer now bundles the NsisMultiUser framework and its UAC and
StdUtils plugins. Add a NOTICE entry (mirroring the existing NSIS multi-license
entry) covering all three: NsisMultiUser (MIT), the UAC plug-in (zlib/libpng),
and the StdUtils plug-in (LGPL-2.1), with full license texts.
The Windows installer bundles the nsProcess plugin (running-instance
detection); add its NOTICE entry: Copyright (C) 2006 Shengalts Aleksander aka
Instructor, zlib/libpng license.
@gtritchie

Copy link
Copy Markdown
Member Author

Moving to draft until we've branched for release for 2026.07 (this PR is for 2026.08).

@gtritchie
gtritchie marked this pull request as draft July 7, 2026 18:00
@github-actions

github-actions Bot commented Jul 7, 2026 •

Copy link
Copy Markdown

RStudio E2E - all platforms

All tests passed!

#################### 100% pass rate

Passed Failed Skipped Flaky
1806 0 53 2
Platform ✅ Passed ❌ Failed ⚠️ Skipped 🔁 Flaky
✅ desktop-linux 456 0 10 0
✅ desktop-macos 456 0 10 0
✅ desktop-windows 456 0 12 0
✅ server-linux 438 0 21 2
View / download the full report

View report online -- opens in the browser, no download needed. Available for 14 days.

Download playwright-report.zip -- extract and open index.html

Includes screenshots, traces, and step-by-step details for every test. Expires in 15 days.


All platforms - commit bf66ce6f59cc904d1d25f0a54eb4874c037bbd9d - Run #123

gtritchie added 2 commits July 7, 2026 14:41
Pass the install mode (/allusers or /currentuser) to the previous version's
uninstaller during 'remove previous installation'. NsisMultiUser rejects a
silent uninstall with no mode, so upgrades otherwise failed to remove the old
version.

In un.onInit, only de-elevate a current-user uninstall. An all-users uninstall
now stays elevated instead of being relaunched as the shell user, so an
unattended elevated machine uninstall is not broken.
@posit-snyk-bot

posit-snyk-bot commented Jul 8, 2026 •

Copy link
Copy Markdown
Contributor

✅ Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
✅ Open Source Security 0 0 0 0 0 issues
✅ Licenses 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

gtritchie added 3 commits July 8, 2026 14:55
The NsisMultiUser-based installer requires /allusers or /currentuser for a
silent (/S) install; without a mode it exits with an invalid-parameters error
and installs nothing. The Windows e2e workflows install machine-wide to
C:\Program Files\RStudio, so pass /allusers alongside /S.
@gtritchie
gtritchie marked this pull request as ready for review July 8, 2026 21:29
gtritchie added 4 commits July 8, 2026 16:19
ExecShellAsUser's result was ignored and the elevated uninstaller quit
unconditionally, so a failed relaunch (no shell to impersonate, blocked
child launch) exited without uninstalling anything and with no message.
Quit only when a child was actually launched (ok/fallback); otherwise
fall through to MULTIUSER_UNINIT and continue elevated.

Also correct the de-elevation comments: the relaunch exists because an
elevated instance resolves $LOCALAPPDATA/HKCU for the wrong user, not
to avoid a UAC prompt (that prompt has already happened).
NsisMultiUser rejects silent installs that specify neither /allusers
nor /currentuser, so existing 'RStudio-*.exe /S' deployment scripts
would exit nonzero having installed nothing. Call out the new required
flag in the release notes.
The shared install helper creates the version folder before
downloading, so a failed download left an empty folder that later runs
skipped as 'already installed'. Remove such remnants before installing
(mirroring the existing quarto guard) and exit with an error if the
framework header is still missing afterwards.
A missing include directory is not a makensis error; it only surfaced
deep inside cpack as '!include: could not find: "UAC.nsh"'. Fail at
configure time with a message that names the fix.
@gtritchie
gtritchie merged commit c16370a into main Jul 9, 2026
24 checks passed
@gtritchie
gtritchie deleted the feature/windows-per-user-install branch July 9, 2026 21:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Per-user install of RStudio on Windows doesn't uninstall cleanly Allow RStudio installer to install without admin privilges

2 participants