Wouldn’t it be nice to compile your own .NET COM DLL and use it on AutoIT.
Well we don’t need much to do this. Everything is available on your system.
Let’s see :
First we need of course some VB.Net code or C# that will exposes some methods or properties.
Imports System.Collections.Generic Imports System.Text Imports System.Runtime.InteropServices Namespace myDotNetLibrary &lt;classinterface (CLASSINTERFACETYPE.AUTODUAL)&gt; _ Public Class myDotNetClass Private myProperty As String Public Sub New() End Sub Public Function myDotNetMethod(input As String) As String Return &quot;Hello &quot; &amp;amp; input End Function Public Property myDotNetProperty() As String Get Return myProperty End Get Set(ByVal value As String) myProperty = value End Set End Property End Class End Namespace
Next we need a .Net compiler ? Ha but that is default available on each system that has a .Net Framework installed
Go and have a look here : C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\vbc.exe
The vbc.exe is the compiler for the .Net 2.0 framework. But you will find as well the compiler for .NET 3.0 and 4.0 if you have that framework installed.
So now we need to compile the code to a DLL and register it.
Ones you run the code it will compile the code to a DLL and register it in the GAC
Or if you want don’t want to register the COM Assembly to the GAC, you can use this approach 😉
And run it as a COM object, where AU3 will access it’s methods and properties.
You can see if the COM object registered correctly here :
For a C# compiler you need to look for the csc.exe instead of the vbc.exe