anthip
anthip

Reputation: 163

Migrating addin to Rvt2025 - WPF raises exception

I have successfully migrate my addin fron .NET Framework to .NET Core, except for WPF windows.

Every command that opens a WPF window raises an Exception "could not load file or assembly" on InitializeComponent().

Windows forms perform well, no issue. I've added <UseWPF>true</UseWPF> to project configuration file.


Update:

It is due to .dll version information

Exception raised:
"Could not load file or assembly <assemblyname>, Version=0.30.1.65535, Culture=neutral, PublicKeyToken=null"

Loaded Assembly:

"<assemblyname>, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null"

When changed version information to 0.0.0.0 all run well.

How can I set correctly the assembly version on .NET Core? When changing in project properties dialog box, seams to make the above problem...

Upvotes: 0

Views: 272

Answers (2)

anthip
anthip

Reputation: 163

Founded the issue! The .dll was being built always with version 0.0.0.0 despite the filling of correct values on VS project properties. That behavior was due to an entry on the project configuration file as bellow:

<GenerateAssemblyInfo>false</GenerateAssemblyInfo>

That line supresses auto-generated assembly attributes.

After removing that line all was corrected!

Upvotes: 0

Jeremy Tammik
Jeremy Tammik

Reputation: 8339

In the Revit 2025 API, you might be able to use AssemblyLoadContext to implement dependency isolation and manage the isolation process, like Nice3point.Revit.Toolkit, cf., RevitLookup Dependency Isolation Ends DLL Hell.

Upvotes: 0

Related Questions