BIM World
A Professional BIM Learning Platform


Revit Secondary Development: Building Multi-Version Frameworks for Simplified Programming

Revit undergoes significant updates every two years, which requires supporting multiple versions during development. However, creating a separate project for each version can be inconvenient since much of the code overlaps. Managing changes across versions can quickly become a headache if updates to an earlier version are not synchronized with later ones. Ideally, multiple versions should share the same classes, with differences resolved through preprocessor directives. This article focuses on how to share classes across versions; for details on preprocessor directives, please refer to other resources.

Here are the detailed steps to set up a multi-version framework:

1. Start by creating an empty solution, then add two projects as shown below:

Revit Secondary Development - How to Build Multi Version Frameworks for Easy Programming

Next, open the project folder and copy the .csproj files from both projects.

Revit Secondary Development - How to Build Multi Version Frameworks for Easy Programming

Revit Secondary Development - How to Build Multi Version Frameworks for Easy Programming

3. Then, remove the two projects from the solution.

Revit Secondary Development - How to Build Multi Version Frameworks for Easy Programming

4. Load the two .csproj files (for versions 17 and 18) into the existing solution by adding them back.

Revit Secondary Development - How to Build Multi Version Frameworks for Easy Programming

Next, open the csproj files for versions 17 and 18 and ensure that the project names (highlighted in red below) are consistent. This completes the multi-version environment setup. Let’s test the results.

Revit Secondary Development - How to Build Multi Version Frameworks for Easy Programming

6. Create a new folder and class in version 17, then copy them to version 18 using Ctrl+C and Ctrl+V. This way, both projects will share the same class files, significantly simplifying multi-version development. It’s recommended to adjust the output path for the build binaries accordingly. With version control systems like SVN, a small team can efficiently develop across multiple versions with half the effort. When working with different APIs across versions, use preprocessor directives to handle these differences.

Revit Secondary Development - How to Build Multi Version Frameworks for Easy Programming

7. Add preprocessor directives in your code and remember to update the AssemblyInfo.cs file accordingly.

Revit Secondary Development - How to Build Multi Version Frameworks for Easy Programming

Revit Secondary Development - How to Build Multi Version Frameworks for Easy Programming

Resources location:

xuebim
Follow the latest BIM developments in the architecture industry, explore innovative building technologies, and discover cutting-edge industry insights.
← Scan with WeChat
Like(0) 打赏
BIM WORLD » Revit Secondary Development: Building Multi-Version Frameworks for Simplified Programming

Comment Get first!

Must log in before commenting!

 

BIM World, A Professional BIM Learning Platform

Stay updated on the latest architecture trends and share new building technologies.

Contact UsAbout Us

觉得文章有用就打赏一下小编吧

非常感谢你的打赏,我们将继续提供更多优质内容,让我们一起创建更加美好的网络世界!

支付宝扫一扫

微信扫一扫

Account Login

By signing in, you agree toUser Agreement

Sign Up