Revit API Forum
Welcome to Autodesk’s Revit API Forums. Share your knowledge, ask questions, and explore popular Revit API topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Does revit target .net standard

15 REPLIES 15
SOLVED
Reply
Message 1 of 16
Anonymous
4270 Views, 15 Replies

Does revit target .net standard

I would like to use .net core to build my plugin but I'm a bit confused whether it will cause issues or not. From my understanding of the .net , if revit targets a specific .net standard, I will be able use any implementation of .net (.net core, or .net framework) that conforms to that standard. Does revit target versions of .net standards or does it just target versions of .net framework? 

15 REPLIES 15
Message 2 of 16
jeremytammik
in reply to: Anonymous

This is clearly defined in the system requirements:

 

For Revit 2021:

 

https://help.autodesk.com/view/RVT/2021/ENU/?guid=Revit_API_Revit_API_Developers_Guide_Introduction_...

 

The Revit Platform API is fully accessible by any language compatible with the Microsoft .NET Framework 4.8, such as Visual C# or Visual Basic .NET (VB.NET). Both Visual C# and VB.NET are commonly used to develop Revit Platform API applications.



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

Message 3 of 16
ollikat
in reply to: Anonymous

I wonder whether people in the factory would be willing to give any comments, is the future Revit API ever going to be targeting .NET 5 (or never 6, 7 etc. in the future)? I'm a bit curious because it seems that .NET framework 4.8 will be tthe last release of it's kind.

Message 4 of 16
jeremy_tammik
in reply to: ollikat

Good question! Thank you for that.

 

[Q] Will we be able to use the Revit API with .NET 5? 

 
[A] The factory should try to be prepared to answer. So far, there are complications. Revit consumes Autodesk-wide .NET components. We'd need to ensure that those are .NET 5 compatible before we switch our runtime. Revit API also runs in-process using Revit's runtime, so I'm not sure it would be possible to preserve Revit's 4.8 runtime and allow add-in code to run .NET 5.0. We have not tested either scenario yet. 

   
Basically, developers will be able to reference Revit's dlls (.NET 4.8) in their .NET 5 projects, but there is no guarantee that everything will work. Some (if not most) things might, but I would not recommend going that way. The problem is that .NET 5 is based on .NET Core, not on the big .NET framework, and there are some incompatibilities.

  
As for switching Revit to .NET 5, that's something we will definitely need to do as .NET 4.8 is the last version of the big .NET. However, the switch is not as trivial as changing the version dropdown (like it was from 4.7 to 4.8). We will have to convert to a new project format, fix some code and possibly find replacement for some frameworks that were present in .NET 4.8, but are not anymore in .NET 5.

  

I hope this helps.

  

Cheers, 

  

Jeremy

  

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open
Message 5 of 16
jeremy_tammik
in reply to: ollikat

I added a summary of this thread to The Building Coder to make it easier to find and read:

 

https://thebuildingcoder.typepad.com/blog/2021/01/face-triangulation-lod-net-5-and-core.html#2

 

Thiago Almeida added a very helpful additional clarification to that:

 

https://thebuildingcoder.typepad.com/blog/2021/01/face-triangulation-lod-net-5-and-core.html#2.1

 

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open
Message 6 of 16
nice3point
in reply to: Anonymous

Can we expect an upgrade to .Net 5+ in the 2023 version of Revit? There are many cool libraries on .Net 5, but we can't use them to develop add-ins yet.

Message 7 of 16
jeremy_tammik
in reply to: nice3point

I asked the devteam for you.

   

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open
Message 8 of 16
jeremy_tammik
in reply to: nice3point

So far, there are complications. Revit consumes Autodesk-wide .NET components. We'd need to ensure that those are .NET 5 compatible before we switch our runtime. Revit API also runs in-process using Revit's runtime, so I'm not sure it would be possible to preserve Revit's 4.8 runtime and allow add-in code to run .NET 5.0. We have not tested either scenario yet.

 

Basically, an add-in can reference Revit's dlls (.NET 4.8) in their .NET 5 projects, but there is no guarantee that everything will work. Some (if not most) things might, but I would not recommend going that way. The problem is that .NET 5 is based on .NET Core, not on the big .NET framework, and there are some incompatibilities.

  

As for switching Revit to .NET 5, that's something we will definitely need to do as .NET 4.8 is the last version of the big .NET. However, the switch is not as trivial as changing the version dropdown (like it was from 4.7 to 4.8). We will have to convert to a new project format, fix some code and possibly find replacement for some frameworks that were present in .NET 4.8, but are not anymore in .NET 5.

  

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open
Message 9 of 16
sgermanoZ2Y2F
in reply to: Anonymous

Im also very interested in this as well. I typically have a class library where all of my revit api work is done (MVVM) project so I split out my API methods anyways. I wonder if that project is target for .NET Framework and then the WPF or Blazor project can be .NET 6 and not have any issues. I wouldnt think so, but only one way to find out!

Message 10 of 16
vubaxaj
in reply to: jeremy_tammik

Dear Jeremy,

Probably, switch of entire CAD runtime is not required.

 

I checked that the minimal .NET 6 add-in (see attachment) works on SolidWorks 2021. They use COM technologies, similar as it was e.g. for Inventor till 2011, before the way through .addin file was introduced.

 

I tried the minimal .NET 6 add-in  (see attachment) in Inventor 2022 through .addin file way - it displays in the add-ins list but does not load unfortunately. Also, I tried the COM way - registered add-in with regsvr32.exe and setup proper registry entries to get add-in visible for Inventor (as described here, search for ' #Region "COM Registration" '), but it even not appears in the add-ins list, so seems this old way no more supported.

 

Maybe, if turn on back the old add-in registration way, then Inventor will can load .NET 6 add-ins as it can SolidWorks do for now.

Unfortunately, for Revit it might means to move on COM API to support such thing.

 

Maybe, if it might be easier and more quick to implement ability to register a .NET 6 add-in via the old way through COM + registry entries, then it would a working solution for nearest years till Revit and Inventor will switch their runtime to .NET <latest>?

Message 11 of 16
vubaxaj
in reply to: vubaxaj

Sorry for disturb. It actually can works now (see attachment).

 

Many thanks to guys from the thread.

Message 12 of 16
vubaxaj
in reply to: vubaxaj

Yeap.... It can works, but it does not really work.

I faced exception of runtime in attempt to find file "<execution root>\Config\machine.config", and also Inventor's application events does not raise to the .NET 6 add-in (like OnActivateDocument or OnQuit etc.). In SolidWorks has no such issues with .NET 6 add-in.

 

=( Will wait for Autodesk CADs to switch on new .NET runtime.

Message 13 of 16
vubaxaj
in reply to: vubaxaj

😃 It is ok, again. I forgot to store references to event objects. Exception with "machine.config" could be just ignored.

So, running well.

Message 14 of 16
hamati_rami2004
in reply to: Anonymous

.NET 5 has been out there for a while, and it's not really compatible with .NET Framework. While both of them can consume .NET Standard, the reverse is not true. Revit has been designed to consume .NET Framework apps and anything developed under .NET 5 is not guaranteed and therefore cannot be offered to any customer. 

Will the devteam consider at some point .NET 5? 

Message 15 of 16

Yes.

  

You can search this forum to find several previous discussions of this topic:

 

https://forums.autodesk.com/t5/forums/searchpage/tab/message?advanced=false&allow_punctuation=false&...

   

Oh.

 

I see that that pointer leads back to this thread. 

  

Well, anyway, to repeat: yes, it is being considered, very seriously, and a huge number of constraints and dependencies need to be considered. 

  

As always, please register your wishes in the Revit Idea Station, and check for plans in the Revit Roadmap.

  

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open
Message 16 of 16

Thank you

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report