ScottBeebiWan
ScottBeebiWan

Reputation: 119

Microsoft Agent "was unable to start"

I followed an old tutorial for using MS Agent with C#, and i'm not going to use an alternative to it, I specifically want to use MS Agent.

I added a refrence to the COM object Microsoft Agent Control 2.0 in refrences (and had to fix some code to have proper syntax again).

I'm using Windows 10, but that isn't an issue, MASH, for example, works fine.

If I build it for x86, I get the following error:

this error

Building for x64 tells me it isn't registered (makes sense):

unregistered

Here's my code:

public partial class Form1 : Form
{
    private AgentObjects.Agent Agent1;

    public Form1()
    {
        InitializeComponent();
    }
    private void Form1_Load(object sender, EventArgs e)
    {
        try
        {
            Agent1 = new AgentObjects.Agent();
            Agent1.Characters.Load("Ralsei", "Ralsei.acs");
            var ralsei = Agent1.Characters["Ralsei"];
            ralsei.Show();
        }
        catch (Exception ex)
        {
            MessageBox.Show("Can't use MS Agent.\n"+ex.ToString());
        }
    }
}

As you can see, the only event Form1 has is Load, so I didn't bother adding the Design.cs.

Update 1: This problem actually seems to NOT have to do with running Windows 10, like I thought it might have. Building this for .NET 4 and running it on XP shows the same error.

the error on xp

Update 2: I decided to mess around with VBScript, which works fine with similar code????

working fine in VBScript

Update 3: I thought hmm, maybe VBScript does this differently than I am in C#, and decided to try using an ActiveX Object.

enter image description here

Literally the same error, thank you C# very cool

Upvotes: -1

Views: 936

Answers (2)

Itay Podhajcer
Itay Podhajcer

Reputation: 2654

Unfortunately, according to Introduction to Microsoft Agent, it seems that:

[Microsoft Agent is deprecated as of Windows 7, and may be unavailable in subsequent versions of Windows.]

And that's probably why your getting the Agent was unable to start error message.

Regarding the more cryptic message, it's probably because you don't have an x64 version of the COM library installed in your Registry (which won't help you even if you did have it, as the service is deprecated).

Hope it helps!

Upvotes: 0

Zagavarr
Zagavarr

Reputation: 301

If you have Windows 10 64-bit, you could install free TTS program Claude to fix the error 0x800400154.

Also, keep in mind, what if your C# project targets x86, when you must add reference to "C:\Windows\MSAgent64\AgentCtl.dll" and if your C# project targets x64, when you must add reference to "C:\Windows\MSAgent\AgentCtl.dll".

Upvotes: 0

Related Questions