.NET Framework

.NET Framework

moj
Contributor Contributor
1,821 Views
3 Replies
Message 1 of 4

.NET Framework

moj
Contributor
Contributor

Hi,

 

I have been developing Revit add-ins since Revit 2017. I have created a multi-version solution in Visual Studio so I only have one place to edit my code across all versions. Works lige a charm.

 

Revit 2021 and 2022 is targeting .NET 4.8 and therefore my whole project is using that and when i compile my code to Revit 2017 is works great using .NET 4.8.

 

Are there any issues by doing what I am doing? I am asking because i can see other places that other developers are not only targeting different Revit versions but also the specific .NET version.

 

Why is that, if you can compile using the highest supportet .NET framework which is now 4.8 and compile it for all versions of Revit without any issues?

0 Likes
1,822 Views
3 Replies
Replies (3)
Message 2 of 4

kevinaugustino
Contributor
Contributor

There shouldn't be any issues targeting .net framework 4.8 because .net framework is backwards compatible. But since you're targeting 4.8, the 4.8 runtimes should be installed on the client machine; You may want to ensure 4.8 runtimes are installed by your plugin's installer. For example, since Revit 2017 targets .net framework 4.6 (I think?) you aren't guaranteed that someone trying to use your plugin in 2017 has .net framework 4.8, as the Revit installer wouldn't have installed it already for you. If you care enough, you could edit your .csproj to conditionally target different framework versions for each of your project's build configurations (EX: https://stackoverflow.com/questions/48745318/net-different-target-frameworks-via-project-configurati... )

Message 3 of 4

moj
Contributor
Contributor

That's what i thought, thank you for confirming this to me.

 

I will have a look at your link and try to target the specifik .NET version when i have the time.

 

Thank you...

0 Likes
Message 4 of 4

MarryTookMyCoffe
Collaborator
Collaborator

I never had problem with .NET version, the only problem I had was with C# version. Some how create pipe when using LINQ just ignore method, I thought it was my mistake but I rewrite it using for loop and it work. I remember that once sorting on specific parameter in class wasn't working too, In Unit test it work but when I join it with revit project it use just default Sorting.

I personally in my projects make a different platform for all revit versions(i set up net and path to dll there).

-------------------------------------------------------------
--------------------------------|\/\/|------------------------
do not worry it only gonna take Autodesk 5 years to fix bug