.NET version error with Revit 2019

.NET version error with Revit 2019

Kevin.Bell
Advisor Advisor
3,387 Views
2 Replies
Message 1 of 3

.NET version error with Revit 2019

Kevin.Bell
Advisor
Advisor

Hi,

 

I have a routine which creates a new ribbon in Revit with a load of add on that I've written - this works really well in Revit 2016, 2017 and 2018.

 

Looking at the Build properties, it states that the target framework is .Net 4.5.2 - I've never changed this.

 

I build my ribbon using conditional compilation symbols which allows me to specify different version of the Revit DLL files depending on what version of Revit I want to compile for - this works well and allows me to have one set of codings that can be complied for different versions of Revit.

 

So that all worked well until I started with Revit 2019 - when I compile I get this error:

The primary reference "RevitAPIUI" could not be resolved because it has an indirect dependency on the assembly "EssentialsUIAPI, Version=19.0.0.0, Culture=neutral, PublicKeyToken=null" which was built against the ".NETFramework,Version=v4.7" framework. This is a higher version than the currently targeted framework ".NETFramework,Version=v4.5.2".

I don't quite understand this error, but believe it means that I'm not using the right version of the .net framework. I'm using 4.5.2 and need 4.7

 

So if I install 4.7, will this stop me compiling code for the earlier versions of Revit (2016, 2017 and 2018?).

 

Is there a way to use 4.5.2 for 2016, 2017 and 2018 and use 4.7 for 2019 - I can't believe that I'll have to maintain two sets of code for each .net version?

 

I'd appreciate some advice on this.

Thanks.

 

 

 

 

0 Likes
Accepted solutions (1)
3,388 Views
2 Replies
Replies (2)
Message 2 of 3

john_dalessandro
Contributor
Contributor
Accepted solution

"The .NET Framework 4.5 and later versions are backward-compatible with apps that were built with earlier versions of the .NET Framework."
I would recommend switching all of your projects to 4.7 to make things easier, plus then you'll always be working with the latest .NET, which also provides other advantages.

 

https://docs.microsoft.com/en-us/dotnet/framework/migration-guide/version-compatibility

0 Likes
Message 3 of 3

Kevin.Bell
Advisor
Advisor

That worked fine - thanks.

0 Likes