# Using .NET Framework DLL's in Xojo

**URL:** <https://forum.xojo.com/t/using-net-framework-dlls-in-xojo/75952>\
**Category:** Getting Started\
**Created:** [May 30, 2023, 3:48am UTC](https://forum.xojo.com/t/using-net-framework-dlls-in-xojo/75952 "2023-05-30T03:48:23Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Philip\_Stenson](https://forum.xojo.com/user_avatar/forum.xojo.com/philip_stenson/32/5995_2.png) [@Philip\_Stenson](https://forum.xojo.com/u/Philip_Stenson)\
**Post date:** [May 30, 2023, 3:48am UTC](https://forum.xojo.com/t/using-net-framework-dlls-in-xojo/75952/1 "2023-05-30T03:48:23Z")

</div>

I have seen a few other posts on this forum in regards to using a DLL in Xojo, one in particular was todo with a .NET DLL (Not sure if it was a Framework or just .NET DLL). I have a query to a .NET framework DLL (.NET 4.7.2) called Easymodbus.dll. I am trying to use this in Xojo for an application but the standard declare method does not work due to the DLL not exporting any modules etc because it is a framework class library. Is this correct? and is there a work around in Xojo for this. The library works fine in VS 2022 with a .NET framework (4.7.2) VB app but not with a .NET (7.0) VB app.  
The error message in Xojo is ‘cannot find function xxx in easymodbus.dll’

---

<div class="post-metadata">

**Author:** ![Greg\_O](https://forum.xojo.com/user_avatar/forum.xojo.com/greg_o/32/22785_2.png) [@Greg\_O](https://forum.xojo.com/u/Greg_O)\
**Post date:** [May 30, 2023, 11:25am UTC](https://forum.xojo.com/t/using-net-framework-dlls-in-xojo/75952/2 "2023-05-30T11:25:36Z")

</div>

I attempted this about 6 weeks ago and I might as well share what I found…

There’s a few references out there about exposing .NET dlls for use with Win32 apps, but they all point to a single VS plugin from 8-10 years ago for exporting the DLL names correctly. That plugin does not work in modern versions of VS, I was only able to even try it in VS 2015 and it was already flakey there. If you do manage to get it working, you’ll basically need to create a bridge or a wrapper class which exposes all the things you’ll need to access.

More info can be found here

> <https://stackoverflow.com/questions/4818850/is-is-possible-to-export-functions-from-a-c-dll-like-in-vs-c>

---

<div class="post-metadata">

**Author:** ![Philip\_Stenson](https://forum.xojo.com/user_avatar/forum.xojo.com/philip_stenson/32/5995_2.png) [@Philip\_Stenson](https://forum.xojo.com/u/Philip_Stenson)\
**Post date:** [May 31, 2023, 10:37pm UTC](https://forum.xojo.com/t/using-net-framework-dlls-in-xojo/75952/3 "2023-05-31T22:37:43Z")

</div>

Thanks Greg 🙂

---

<div class="post-metadata">

**Author:** ![Björn\_Eiríksson](https://forum.xojo.com/letter_avatar_proxy/v4/letter/b/da6949/32.png) [@Björn\_Eiríksson](https://forum.xojo.com/u/Bj%C3%B6rn_Eir%C3%ADksson)\
**Post date:** [June 1, 2023, 12:30am UTC](https://forum.xojo.com/t/using-net-framework-dlls-in-xojo/75952/4 "2023-06-01T00:30:55Z")

</div>

The .NET component must be compiled with COM registration. So if you did not make the .NET component and it does not have COM registration then you will not be calling managed code which .NET is from non managed code (which Xojo is).

However in such case then you still could bridge it by creating your own .NET component that calls the 3rd party .NET component. And your .NET component would be compiled with COM registration.

---

<div class="post-metadata">

**Author:** ![Geoff\_H1](https://forum.xojo.com/user_avatar/forum.xojo.com/geoff_h1/32/5987_2.png) [@Geoff\_H1](https://forum.xojo.com/u/Geoff_H1)\
**Post date:** [June 1, 2023, 5:08am UTC](https://forum.xojo.com/t/using-net-framework-dlls-in-xojo/75952/5 "2023-06-01T05:08:28Z")

</div>

I have had some success with the upgraded versions of UnmanagedExports.

> **[UnmanagedExports.Repack.Upgrade 1.2.1](https://www.nuget.org/packages/UnmanagedExports.Repack.Upgrade)**
>
> Repackaging of UnmanagedExports 1.2.7 to be compatible with PackageReference and additionally upgraded the Microsoft Build Utilities (using Nuget package Microsoft.Build.Utilities).
> 
> A set of compile-time libraries (nothing to deploy) and a...
