Click here to Skip to main content
15,798,066 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I need to use to interop features of a DLL in my WPF application, but without adding the DLL as a reference in my project. How would add this DLL at runtime and call a method in the DLL?

What I have tried:

The DLL's function works just fine if I add the DLL as a reference and call the method like this:
InteropAssembly.LabVIEWExports.WaveForm_Analysis(xyValues, out avgTorque, out bdcLocation, out bdcValue, out tdcLocation, out tdcValue, out startTorqueLocation, out startTorqueValue);
Updated 29-Aug-18 22:43pm
F-ES Sitecore 30-Aug-18 4:19am    
Reading between the lines, if you are looking to create an application that doesn't need the application it is using installed then that's not possible.

That's the right way to do it: if your code needs a .NET assembly, then adding a reference is the right way to do it.

You can do it without, but it's a lot more complex, and makes your code a lot harder to read: C# - Execute code from a .NET DLL (Class Library) without referencing it? - Stack Overflow[^]
Share this answer
Share this answer
TheRedEye 30-Aug-18 5:36am    
All the searched examples that show refection as the solution make use of .Net assemblies. This DLL isn't a .net assembly, it's LabView made library.
Richard MacCutchan 30-Aug-18 7:29am    
Sorry but I have no idea what "LabView made" means. Is it a .NET library or unmanaged code? I would suggest you will get a quicker answer by asking the people who created the DLL.
TheRedEye 31-Aug-18 10:43am    
Yes, its unmanaged code.Thanks Richard, unmanaged dll is what I should have been googling help with.
Richard MacCutchan 31-Aug-18 12:43pm    
Why not just use it the way it works?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900