Revit Multi-Version Addin Development - C#

Revit Multi-Version Addin Development - C#

Verma7UKV3
Contributor Contributor
1,208 Views
4 Replies
Message 1 of 5

Revit Multi-Version Addin Development - C#

Verma7UKV3
Contributor
Contributor

Hey Community of Developers!
I have been developing custom Revit add-ins via C# and Visual Studio for the past few months. I have had success in establishing the basic workflow for multi-version development where I have a shared project and individual version projects (2022, 2024) with references to the shared project.
Everything is working fine and I have customizations and data reporting that work but I am having trouble in getting WPF to work in order to implement user-inputs or a better way of visually designing or organizing the UI.
I read somewhere that this is a regular commonly known problem with shared projects.
Anyone ho has a better workflow for multi-version development please share some of your insights. A solo self-taught developer here, it gets difficult to find solutions to such problems.
Also any resources to learn the MVVM pattern to develop for Revit would be really helpful.
Thankyou! 

0 Likes
1,209 Views
4 Replies
Replies (4)
Message 2 of 5

Mohamed_Arshad
Advisor
Advisor

Hi @Verma7UKV3 

 

   There are many examples in internet but among those best one is @nice3point Revit Templates which are by default supporting for Multi version and for MVVM pattern aswell. You can directly download it from nuget package manager 

 

Revit Templates

https://github.com/Nice3point/RevitTemplates 

 

kindly check the below link for additional references 


https://archi-lab.net/how-to-maintain-revit-plug-ins-for-multiple-versions/ 

 

https://github.com/alvpickmans/multiversion-revit-plugin-sample 

 

Hope this will Helps 🙂

 

 


Mohamed Arshad K
Software Developer (CAD & BIM)

Message 3 of 5

Mohamed_Arshad
Advisor
Advisor

Hi @Verma7UKV3 

 

   There are many examples in internet but among those best one is @nice3point Revit Templates which are by default supporting for Multi version and for MVVM pattern aswell. You can directly download it from nuget package manager 

 

Revit Templates

https://github.com/Nice3point/RevitTemplates 

 

kindly check the below link for additional references 


https://archi-lab.net/how-to-maintain-revit-plug-ins-for-multiple-versions/ 

 

https://github.com/alvpickmans/multiversion-revit-plugin-sample 

 

Hope this will Helps 🙂

 

 


Mohamed Arshad K
Software Developer (CAD & BIM)

0 Likes
Message 4 of 5

Verma7UKV3
Contributor
Contributor
Hey, thankyou... will give this a look!
0 Likes
Message 5 of 5

JC_BL
Advocate
Advocate

You may know this already.  But I mention this anyway.

 

Use Platform-Specific Visual Studio Project File:

I use one Visual Studio Solution file.  And then I use a separated Visual Studio project file for each platform (like CAMduct 2019, CADmep 2019, CADmep 2021, Revit 2021, Revit 2022, Revit 2022).  Then I can assign platform specific source code files to each Visual Studio project file.  This largely isolates platform specific things to each project.

 

Use Preprocessor Variables:

Sometime a source code file is being used in multiple platforms because by and large it is compatible to all those platforms.  But there are some minor differences that I need to take care of (may be the API syntax or a property name is different from one platform to the other platform).  In that case, I use preprocessor variable like this to account for the difference:

#if   ( RVT2021 || RVT2022 )
   ...
#elif ( RVT2023 || RVT2024 ) 
   ...
#endif

And then define those preprocessor variables in Project Properties of the Visual Studio Project file.

 

Use Virtual/Derived Class:

Using preprocessor variable is not the only way to account for the difference.  I also use a virtual class as an umbrella class to hide the difference.  And then implement the platform specific stuff in the derived classes.  Then the calling program only needs to deal with the interface of the virtual class.

 

Use Platform-Specific Member Variables:

Using derived classes is not the only way to hide the difference.  I also use an umbrella class that has platform specific stuffs hidden in its member variables:

class CUnifiedUI
   {
   private int fUseUIType = 1;      // 1 for UI-Type-1, 2 for UI-Type-2.
   private CUIType1 uiType1 = null; // Specific to a platform.
   private CUIType2 uiType2 = null; // Specific to other platforms.

   public void SetToUseUIType1()
      {
      this.fUseUIType = 1;
      }
   public void SetToUseUIType2()
      {
      this.fUseUIType = 2;
      }
   public void DoSomething()
      {
      if      ( this.fUseUIType == 1 ) this.uiType1.DoSomething();
      else if ( this.fUseUIType == 2 ) this.uiType2.DoSomething();
      }
   }

I don't remember exactly why I have to use this last method.  But I use this to deal with the difference in user interface between CAMduct and CADmep (and later Revit).  For example, we can show message in the command line in CADmep, but the command line window is not available in CAMduct (or Revit).

 

I find that I need to use all 4 methods to deal with the different platforms.  Some may work better than the others.

 

JC_BL