revit-api

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...


Solution

  • 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!