Skip to content

Refactor GetRevitAddonsFilePath method and add unit tests for allusers parameter handling#3049

Merged
jmcouffin merged 2 commits intodevelopfrom
fix/explicit-install-scope
Feb 1, 2026
Merged

Refactor GetRevitAddonsFilePath method and add unit tests for allusers parameter handling#3049
jmcouffin merged 2 commits intodevelopfrom
fix/explicit-install-scope

Conversation

@jmcouffin
Copy link
Copy Markdown
Contributor

@jmcouffin jmcouffin commented Feb 1, 2026

This is a phase 1 change to the installers behavior to fix existing issues


  • Removed unnecessary elevation check in GetRevitAddonsFilePath method.
  • Updated unit tests to verify behavior of GetRevitAddonsFilePath with allusers parameter for different Revit versions.
  • Ensured paths are correctly returned based on user and allusers settings.

fixes: #2611


1.1 – GetRevitAddonsFilePath (RevitAddons.cs)

  • Removed the elevation block that forced allusers = true when running elevated.
  • Removed the unused rootFolder variable.
  • Kept the single return that uses GetRevitAddonsFolder(revitYear, allUsers: allusers).
    GetRevitAddonsFilePath now only uses the allusers parameter; elevation no longer overrides it.

1.2 – Admin installer (pyrevit-admin.iss)

  • In the [Run] step “Attaching this clone…”, parameters changed from
    "attach master default --installed"
    to
    "attach master default --installed --allusers".

1.3 – Per-user installer (pyrevit.iss)

  • Confirmed the attach [Run] line is
    Parameters: "attach master default --installed"
    (no --allusers). No change made.
    1.5 – Unit tests (pyRevitLabs.UnitTests.RevitAddons.cs)

  • Existing tests already use allusers: false and do not rely on elevation overriding allusers; no changes needed there.

  • Added GetRevitAddonsFilePath_ExplicitAllUsers_Test:

    • allusers: false → path contains AppData or Roaming.
      - allusers: true for 2026 → path under CommonApplicationData.
    • allusers: true for 2027 → path contains Addins and 2027 and ends with TestAddin.addin.

Verification

  • Build: dotnet build pyRevitLabs.sln -c Release completed successfully (0 errors; existing SYSLIB0014 warnings only).
  • Tests: Unit test run finished with exit code 0.

Behavior

  • Per-user installer (even when run elevated): .addin goes to user scope: %AppData%\...\Revit\Addins\<YEAR>\
  • Admin installer: .addin goes to all-users scope (ProgramData for Revit ≤2026, Revit install path for 2027+), because the post-install step uses --allusers

…s parameter handling

- Removed unnecessary elevation check in GetRevitAddonsFilePath method.
- Updated unit tests to verify behavior of GetRevitAddonsFilePath with allusers parameter for different Revit versions.
- Ensured paths are correctly returned based on user and allusers settings.
@jmcouffin jmcouffin self-assigned this Feb 1, 2026
@jmcouffin jmcouffin added the Installer Issues related to the pyRevit installer [subsystem] label Feb 1, 2026
@jmcouffin jmcouffin requested a review from Copilot February 1, 2026 15:22
devloai[bot]

This comment was marked as outdated.

This comment was marked as outdated.

@jmcouffin jmcouffin merged commit ad0aa8a into develop Feb 1, 2026
@jmcouffin jmcouffin deleted the fix/explicit-install-scope branch February 1, 2026 15:35
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Feb 1, 2026

📦 New work-in-progress (wip) builds are available for 5.3.1.26032+1538-wip

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Feb 1, 2026

📦 New work-in-progress (wip) builds are available for 5.3.1.26032+1543-wip

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Feb 1, 2026

📦 New work-in-progress (wip) builds are available for 5.3.1.26032+1553-wip

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Feb 1, 2026

📦 New work-in-progress (wip) builds are available for 5.3.1.26032+1612-wip

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Feb 1, 2026

📦 New work-in-progress (wip) builds are available for 5.3.1.26032+1624-wip

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Feb 1, 2026

📦 New work-in-progress (wip) builds are available for 5.3.1.26032+1738-wip

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Feb 1, 2026

📦 New work-in-progress (wip) builds are available for 5.3.1.26032+1743-wip

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Feb 1, 2026

📦 New work-in-progress (wip) builds are available for 5.3.1.26032+1829-wip

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Feb 1, 2026

📦 New work-in-progress (wip) builds are available for 5.3.1.26032+1937-wip

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Feb 1, 2026

📦 New work-in-progress (wip) builds are available for 6.0.0.26032+1956-wip

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Feb 1, 2026

📦 New work-in-progress (wip) builds are available for 6.0.0.26032+2005-wip

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Feb 1, 2026

📦 New work-in-progress (wip) builds are available for 6.0.0.26032+2008-wip

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Feb 1, 2026

📦 New public release are available for 6.0.0.26032+2040

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Feb 1, 2026

📦 New public release are available for 6.0.0.26032+2040

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Installer Issues related to the pyRevit installer [subsystem]

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: 5.0.1 user-based install puts pyrevit.addin file in ProgramData

2 participants