Could not load file or assembly from Nuget package

Could not load file or assembly from Nuget package

Anonymous
Not applicable
1,622 Views
1 Reply
Message 1 of 2

Could not load file or assembly from Nuget package

Anonymous
Not applicable

I have installed a NuGet package (NumericUpDownLib) on a Revit-Addin project , it works in designer view and I also have tested the package in a separate WPF application and it works just fine. however, when I load the addin and run the command I get this error 

 

Could not load file or assembly 'NumericUpDownLib, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.

 

A copy of the dll is placed in the same folder as addin.dll , so why revit do not load this dependency ?

thanks for your help 

 

0 Likes
1,623 Views
1 Reply
Reply (1)
Message 2 of 2

RPTHOMAS108
Mentor
Mentor

.net will search the base directory of the current AppDomain which is where Revit.exe resides. It is not recommended to put dll's there however.

 

A common approach is to subscribe to AppDomain.AssemblyResolveEvent in order to specify where the system should look for an assembly when it can't find it.

Solved: Re: Missing System.ComponentModel.Annotations v4.2.0.0 - Autodesk Community - Revit Products

AppDomain.AssemblyResolve Event (System) | Microsoft Docs

 

NumericalUpDown is something relatively easy to create for yourself with custom WPF control, it has always been a bit annoying they don't include it and certain other controls inherent to forms. You could use a forms host in WPF and place one that way also.

0 Likes