Jump to content

Error running AutoItX3 inside Asp.Net 5 controller

Recommended Posts

I'm developing an application in Asp.Net 5 and installed AutoITx3 and when run inside the controller it's giving the following error.

How do I configure AutoItX3 within Asp.Net 5 web Application

  Message=Retrieving the COM class factory for component with CLSID {1A671297-FA74-4422-80FA-6C5D8CE4DE04} failed due to the following error: 80040154 Class not registered (0x80040154 (REGDB_E_CLASSNOTREG)).
   at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean wrapExceptions, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& hasNoDefaultCtor)
   at System.RuntimeType.CreateInstanceDefaultCtorSlow(Boolean publicOnly, Boolean wrapExceptions, Boolean fillCache)
   at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, Boolean wrapExceptions)
   at System.Activator.CreateInstance(Type type, Boolean nonPublic, Boolean wrapExceptions)
   at System.Activator.CreateInstance(Type type)
   at BinaryCoreMVC.Controllers.TradersController.Index() in C:\Users\luizc\source\repos\BinaryCoreMVC\BinaryCoreMVC\Controllers\TradersController.cs:line 37
   at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.SyncActionResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeActionMethodAsync()
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeNextActionFilterAsync()

Link to post
Share on other sites
  • 6 months later...

Hi LuizChequini,

an answer after a half year later is probably not fitting your problem anymore, but it could be helpful for other people to understand that AutoIt can not be used in .NET Core applications. There are several Stackoverflow posts, possibly also here in the forum, about this topic. I tried it for my own with an .NET5 and .NET6 application, but it will not work.

Why in short:
That's because of cross plattform availability with .NET which wasn't the case with the old .NET Framework. I mean since you can not add references like in the past to your project in the solution, you can not expect


and the *.lib

will work out of the box. AutoIt isn't intended to support multiple platforms (only windows). I tried to work-around it and to solve this issue, but I didn't make it or never read about a successful approach till today.

Sorry for not been that helpful but these are the restrictions as far as I understood them and experiered.

Best regards

Stay innovative!

Link to post
Share on other sites

Hi folks,

as a working work-around you can create/write your AutoIt script(s), compile it to a *.exe and call it within your .NET5/6 solution.
It's not elegant or nice, but you have the power of your loved AutoIt functionality within your .NET Core solution :) .

For example like this simplified version of a file upload script:

using System.Diagnostics;
using System.IO;
using System.Reflection;

namespace Example.FileUpload
    public class FileUploader
        private readonly string _codeBaseFolderPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().GetName().CodeBase)?
            .Replace("file:\\", string.Empty);

        public void FillFileOpenDialog(string fileName)
            var documentFilePath = GetDocumentFilePath(fileName);


        private string GetDocumentFilePath(string fileName)
            var documentFilePath = $@"{_codeBaseFolderPath}\FileUpload\Files\{fileName}";

            if (!File.Exists(documentFilePath))
                throw new FileNotFoundException($"Failure: File '{documentFilePath}' was not found.");

            return documentFilePath;

        private void CallAu3FileUploader(string documentFilePath)
            var au3FileUploaderFilePath = $@"{_codeBaseFolderPath}\FileUpload";
            var driveCharacter = documentFilePath[0];

            const string au3FileUploaderExe = "Au3FileUploader.exe";
            const string fileOpenDialogTitle = "Open";

            var startInfo = new ProcessStartInfo
                WindowStyle = ProcessWindowStyle.Hidden,
                FileName = "cmd.exe",
                Arguments = $@" /C {driveCharacter}: && cd ""{au3FileUploaderFilePath}"" && {au3FileUploaderExe} " +
                            $@"""{fileOpenDialogTitle}"" " +


        private void StartAndWaitForProcess(ProcessStartInfo startInfo)
            var process = new Process { StartInfo = startInfo };



Best regards

Stay innovative!

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...