My Revit plugin works on 2022 but not on 2023

My Revit plugin works on 2022 but not on 2023

rtoninJU74S
Explorer Explorer
1,033 Views
3 Replies
Message 1 of 4

My Revit plugin works on 2022 but not on 2023

rtoninJU74S
Explorer
Explorer

Hy,

I'm developing a big plugin (C#) for internal use in my company that manages BCF Issues on the cloud and in Revit. To access data on the Azure cloud, I use the CSLA library and with the Revit 2022 version I've never had any problems. I'm trying to port to version 2023 but as I try to instantiate a class that derives from CSLA Business Obect I get this error:

"Csla.DataPortalException: 'DataPortal.Create failed (Could not find method 'Microsoft.Extensions.DependencyInjection.ServiceProvider Microsoft.Extensions.DependencyInjection.ServiceCollectionContainerBuilderExtensions.BuildServiceProvider(Microsoft.Extensions.DependencyInjection.IServiceCollection)'.)' "

 

I created two minimal solutions, one for Revit 2022 and one for Revit 2023 which I have attached to this post. The first works, the second doesn't, giving the above error.

Where am I wrong? thank you

Rolando Tonin

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

iref3at
Contributor
Contributor

Differences between two versions are the framework, 4.7.2 for 2022 and 4.8 for 2023.

if you already changed the project framework maybe you need to change other dependencies\ libraries\ references to work with the updated framework. Your proplem is not associated with the revit api but with visual studio and other dependencies .. revise references or nugget packages. 

Message 3 of 4

RPTHOMAS108
Mentor
Mentor
Accepted solution

Pretty sure the API changed to 4.8 for 2021 version as evidenced by the 'what's new' document in that version Although I don't keep track I just know we've been using 4.8 for quite some time now. There is a 4.8.1 version now which is strange because I thought they were not updating the .net framework. It kind of shows how things get dragged onwards regardless of certain reluctance to do so. I guess they count it as a minor update although they can still have 4.9 before it gets more confusing. 

 

@rtoninJU74S Your 2023 build event doesn't copy the dlls to the addins folder I don't know if that is an aspect to consider. May also be a conflict with components inherently used in Revit 2023 that are not in 2022 check the executable folder and similar probed locations (although you usually get a type load exception for that).

Message 4 of 4

rtoninJU74S
Explorer
Explorer

hy all,

I continued with my tests based on your indications and I installed the latest version of the CSLA 6.2 library, compatible with .NET framework 4.8. Consequently I had to modify the code for object generation which since version 6 of CSLA is based on DI. Outcome: The plugin is now correctly loaded by Revit 2023 as well. As a result I have to organize myself to rewrite a lot of my code.
Thank you all for the valuable information provided

Rolando

0 Likes