Skip to content

Add support for Revit 2027 secure location for addin manifest#3034

Merged
jmcouffin merged 3 commits intodevelopfrom
copilot/update-revit-addin-location
Jan 30, 2026
Merged

Add support for Revit 2027 secure location for addin manifest#3034
jmcouffin merged 3 commits intodevelopfrom
copilot/update-revit-addin-location

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Jan 25, 2026

Implementation Plan for Revit 2027 Secure Addin Location Support

  • Understand the current implementation in RevitAddons.cs
    • Review GetRevitAddonsFolder() method
    • Review GetManifest() method
    • Review RevitProduct.InstallLocation property
  • Update GetRevitAddonsFolder() method
    • Add logic to check if allUsers == true AND revitYear >= 2027
    • For Revit 2027+, use new secure path from RevitProduct.InstallLocation
    • Maintain backward compatibility for Revit ≤2026
    • Add fallback to default path if Revit not found in registry
    • Update debug message to reflect all scenarios
  • Update GetManifest() method for migration scenarios
    • Search both old and new locations for Revit 2027+
    • Refactor code to use helper function for DRY
    • Use LINQ .Where() with case-insensitive comparison
  • Add unit tests
    • Test all-users path for Revit 2027+
    • Test user-level path for all versions (unchanged)
    • Test all-users path for Revit ≤2026 (unchanged)
    • Test boundary at year 2027
    • Test integration with GetRevitAddonsFilePath
    • Use case-insensitive path comparisons
    • Check path structure instead of hardcoded locations
  • Build and verify changes
    • Build the solution successfully
    • Verify no compilation errors
    • Updated binary DLLs in bin/ folders
  • Code review and security check
    • Initial code review completed
    • Address PR review comments
    • Manual security analysis completed - no vulnerabilities

Code Review Changes Addressed

  1. Debug message clarity (line 75): Updated to "install location not available in registry" to reflect both cases
  2. LINQ filtering (lines 145-146): Used .Where() with StringComparison.OrdinalIgnoreCase for cleaner, case-insensitive filtering
  3. Unit test path comparisons: Updated all StartsWith() calls to use StringComparison.OrdinalIgnoreCase
  4. Unit test assertions: Changed from checking hardcoded Program Files location to verifying path structure (ends with Addins\<year>)
  5. Redundant test removed: Cleaned up misleading test case in GetRevitAddonsFilePath_Consistency_Test

All changes maintain backward compatibility while addressing the code review feedback.

Original prompt

Add support for Revit 2027 secure addin manifest location

Background

Starting with Revit 2027, Autodesk is implementing improved file permissions security for addins. The current all-users addin location (%ProgramData%\Autodesk\Revit\Addins\<year>\) will be deprecated and unsupported starting from Revit 2027.

New Addin Paths (Revit 2027+)

Scope Current Location (≤2026) New Location (2027+) Status
User-level %AppData%\Autodesk\Revit\Addins\<year>\ Same ✅ Still Supported
All users %ProgramData%\Autodesk\Revit\Addins\<year>\ C:\Program Files\Autodesk\Revit <year>\Addins\<year>\ ⚠️ Must Change for 2027+

Reference: Autodesk Revit 2027 security improvements documentation.

Required Changes

The pyRevit attachment system needs to be updated to handle the new secure location for Revit 2027 and later versions.

Files to Modify

  1. dev/pyRevitLabs/pyRevitLabs.TargetApps.Revit/RevitAddons.cs
    • Update GetRevitAddonsFolder() method to return the appropriate path based on Revit version
    • For Revit 2027+, all-users path should be: C:\Program Files\Autodesk\Revit <year>\Addins\<year>\
    • For Revit ≤2026, keep existing behavior: %ProgramData%\Autodesk\Revit\Addins\<year>\
    • User-level installations remain unchanged for all versions

Implementation Details

The GetRevitAddonsFolder() method should:

  1. Accept the revitYear parameter (already exists)
  2. Check if allUsers == true AND revitYear >= 2027
  3. If true, construct path using the Revit installation directory from RevitProduct.InstallLocation property
  4. If false (or revitYear < 2027), use the existing logic

Example logic:

public static string GetRevitAddonsFolder(int revitYear, bool allUsers = false) {
    if (allUsers && revitYear >= 2027) {
        // New secure path for Revit 2027+
        // Get the Revit installation path
        var revitProducts = RevitProduct.ListInstalledProducts();
        var targetRevit = revitProducts.FirstOrDefault(r => r.ProductYear == revitYear);
        
        if (targetRevit != null && !string.IsNullOrEmpty(targetRevit.InstallLocation)) {
            return Path.Combine(targetRevit.InstallLocation, "Addins", revitYear.ToString());
        }
        else {
            // Fallback to default expected path
            var defaultPath = Path.Combine(
                Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles),
                "Autodesk",
                $"Revit {revitYear}",
                "Addins",
                revitYear.ToString()
            );
            return defaultPath;
        }
    }
    else {
        // Existing logic for user-level or Revit ≤2026
        var rootFolder = allUsers ? 
            System.Environment.SpecialFolder.CommonApplicationData : 
            System.Environment.SpecialFolder.ApplicationData;
        return Path.Combine(
            System.Environment.GetFolderPath(rootFolder),
            "Autodesk", 
            "Revit", 
            "Addins", 
            revitYear.ToString()
        );
    }
}

Testing Considerations

  • ✅ Verify backward compatibility with Revit 2026 and earlier
  • ✅ Verify user-level installations continue to work for all versions
  • ✅ Verify all-users installations work with new path for Revit 2027+
  • ✅ Ensure the new path is created if it doesn't exist (CommonUtils.EnsureFile() already handles directory creation)
  • ✅ Admin privileges are required for writing to C:\Program Files\ (already required for all-users installations)

Additional Considerations

The GetManifest() method should also be updated to search both locations for Revit 2027+ when looking for existing manifests, to handle migration scenarios where old manifests might still exist.

Impact Analysis

  • User-level installations: ✅ No impact (path unchanged)
  • All-users installations (Revit ≤2026): ✅ No impact (existing path still supported)
  • All-users installations (Revit 2027+): ⚠️ Required - must use new secure path
  • Existing attachments: Migration may be needed for Revit 2027 upgrades

Documentation Updates

Update documentation to:

  • Inform users about the new requirement for Revit 2027+
  • Explain that admin installers will write to the new secure location
  • Note that old all-users installations will stop working in Revit 2027 unless migrated

Acceptance Criteria

  • GetRevitAddonsFolder() returns correct path for all-users installations on Revit 2027+
  • Backward compatibility maintained for Revit 2026 and earlier
  • User-level installations continue to work unchanged
  • Manifest creation succeeds at new location
  • Manifest reading succeeds from new location
  • Unit tests pass (if applicable)
  • Manual testing confirms attachment works in Revit 2027+

This pull request was created from Copilot chat.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

@devloai
Copy link
Copy Markdown
Contributor

devloai bot commented Jan 25, 2026

Unable to trigger custom agent "Code Reviewer"You have run out of credits 😔
Please upgrade your plan or buy additional credits from the subscription page.

- Update GetRevitAddonsFolder() to use new secure path for Revit 2027+ all-users installations
- Update GetManifest() to search both old and new locations for migration scenarios
- Add unit tests for path logic verification
- Maintain backward compatibility for Revit ≤2026 and user-level installations

Co-authored-by: jmcouffin <7872003+jmcouffin@users.noreply.github.com>
@jmcouffin jmcouffin requested a review from Copilot January 25, 2026 16:52
Copilot AI changed the title [WIP] Add support for Revit 2027 secure addin manifest location Add support for Revit 2027 secure addin manifest location Jan 25, 2026
Copilot AI requested a review from jmcouffin January 25, 2026 16:52
@jmcouffin jmcouffin added Installer Issues related to the pyRevit installer [subsystem] Misc Compatibility Compatibility issue with other third-party addons [class->Updated #{number}: {title}] Command Line Utility (CLI) Issues related to pyRevit CLI tool [subsystem] Highlight Highlight these issues on Release notes labels Jan 25, 2026
@jmcouffin
Copy link
Copy Markdown
Contributor

Ref: FS-ImprovedFilePermissionssecurityforAddins.pdf

  • Support for addins manifest location for 2027+

@jmcouffin jmcouffin marked this pull request as ready for review January 25, 2026 16:57
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds support for Revit 2027+ “secure” all-users addin manifest location and enables migration by searching both old and new manifest folders.

Changes:

  • Update Revit addins folder resolution for Revit 2027+ all-users installs to use the Revit install directory (with a fallback default).
  • Update manifest discovery to search both new (2027+) and legacy locations for migration scenarios.
  • Add unit tests and update committed binaries under bin/ to match the build output.

Reviewed changes

Copilot reviewed 2 out of 31 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
dev/pyRevitLabs/pyRevitLabs.TargetApps.Revit/RevitAddons.cs Implements Revit 2027+ secure all-users addins path logic and dual-location manifest search.
dev/pyRevitLabs/pyRevitLabs.UnitTests/pyRevitLabs.UnitTests.RevitAddons.cs Adds tests for Revit addins folder/path behavior across version boundaries.
bin/netfx/pyRevitLabs.TargetApps.Revit.dll Updated compiled assembly reflecting the source changes.
bin/netfx/System.Threading.Tasks.Extensions.dll Newly added/updated runtime dependency included in bin/netfx.
bin/netfx/System.Runtime.CompilerServices.Unsafe.dll Newly added/updated runtime dependency included in bin/netfx.
bin/netfx/DotNetVersionFinder.dll Newly added/updated dependency included in bin/netfx.
bin/netcore/DotNetVersionFinder.dll Newly added/updated dependency included in bin/netcore.

@jmcouffin
Copy link
Copy Markdown
Contributor

jmcouffin commented Jan 25, 2026

@copilot Review the comments in the pr and make necessary changes

- Update debug message to reflect both cases when install location is not available
- Use LINQ .Where() for filtering files with case-insensitive comparison
- Fix unit tests to use case-insensitive path comparisons
- Update tests to check path structure instead of hardcoded Program Files location
- Remove redundant test case and clarify test intent

Co-authored-by: jmcouffin <7872003+jmcouffin@users.noreply.github.com>
@jmcouffin jmcouffin changed the title Add support for Revit 2027 secure addin manifest location Add support for Revit 2027 secure location for addin manifest Jan 25, 2026
@jmcouffin jmcouffin requested a review from Copilot January 25, 2026 17:56
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 31 changed files in this pull request and generated 5 comments.

@jmcouffin jmcouffin merged commit e4d377a into develop Jan 30, 2026
6 checks passed
@jmcouffin jmcouffin deleted the copilot/update-revit-addin-location branch January 30, 2026 21:07
@github-actions
Copy link
Copy Markdown
Contributor

📦 New work-in-progress (wip) builds are available for 5.3.1.26030+2136-wip

@github-actions
Copy link
Copy Markdown
Contributor

📦 New work-in-progress (wip) builds are available for 5.3.1.26030+2147-wip

@github-actions
Copy link
Copy Markdown
Contributor

📦 New work-in-progress (wip) builds are available for 5.3.1.26030+2212-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+1043-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+1111-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+1304-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+1323-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+1433-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+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

Command Line Utility (CLI) Issues related to pyRevit CLI tool [subsystem] Highlight Highlight these issues on Release notes Installer Issues related to the pyRevit installer [subsystem] Misc Compatibility Compatibility issue with other third-party addons [class->Updated #{number}: {title}]

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants