I am creating an API-Addin for a Program that uses .NET Framework 4.7.2 and I cannot change that. I am adding the ComponentOne (.NET 4.5.2) DLLs in Visual Studio. When the Addin in the external program tries to load the dll, there is an error that the DLL cannot be found. I am pretty sure this problem is caused by the different .NET Framework versions. Is there any workaround which could help when loading DLLs with lower .NET versions?
Asked
Active
Viewed 81 times
-1
-
1What does the error say? There are lots of reason an assembly may not load. Have you looked at what's going on with the _Fusion Log Viewer_ (fuslogvw.exe)? – Flydog57 Jan 19 '22 at 16:37
-
1Did you ensure that the DLL that cannot be found was actually copied to the output folder of the addin? If it's not there, the error message makes perfect sense. – mm8 Jan 19 '22 at 20:39
-
@Flydog57 The error is in german so i translated it: "The File or Assembly "The file or assembly '...' or a dependency thereof was not found. The system can not find the stated file." – Updater Jan 20 '22 at 13:04
-
@mm8 yes, the assembly is in the output folder and was also copied in the addin folder of the program from where it's usually loaded Thank you. I managed to create a solution and I will write a short answer. – Updater Jan 20 '22 at 13:04
1 Answers
0
I managed to find a solution where I manually load the DLL before it is referenced. I used the Assembly.LoadFrom(assemblyPath)
function.
https://learn.microsoft.com/en-us/dotnet/api/system.reflection.assembly.loadfrom?view=net-6.0

Updater
- 459
- 2
- 13