[Mono-list] Problem with Mono.Addins
Joonu
joonu.thomas at polarisft.com
Thu Mar 29 15:51:52 UTC 2012
Hi,
I am trying to run the sample HelloWorldWithManifest.sln program that is
downloadable from monoaddins.codeplex.com But I don't get the desired result
when I run it. When it comes to the line
foreach (ICommand cmd in AddinManager.GetExtensionObjects ("/Commands"))
cmd.Run ();
I get a message saying:
InvalidOperationException
Extension Node not found in path "/Commands"
The details of the code are as follows:
There are 2 projects in the solution - HelloWorld.csproj and
HelloWorldAddin.csproj
HelloWorld.csproj
----------------
ICommand interface
using System;
using Mono.Addins;
namespace HelloWorld
{
// This is an interface which can be implemented by add-ins.
public interface ICommand
{
void Run ();
}
}
Main.cs
using System;
using Mono.Addins;
namespace HelloWorld
{
class MainClass
{
public static void Main (string[] args)
{
// Initializes the add-in engine
AddinManager.Initialize ();
// Looks for new add-ins and updates the add-in registry.
AddinManager.Registry.Update (null);
// Gets all commands implemented in add-ins.
foreach (ICommand cmd in AddinManager.GetExtensionObjects ("/Commands"))
cmd.Run ();
}
}
}
HelloWorld.addin.xml
<Addin id="HelloWorld" version="1.0" isroot="true">
<ExtensionPoint path = "/Commands">
<ExtensionNode name="Command" />
</ExtensionPoint>
</Addin>
HelloWorldAddin.csproj files
--------------------------
HelloCommand.cs
using System;
using HelloWorld;
namespace HelloWorldAddin
{
public class HelloCommand: ICommand
{
public void Run ()
{
Console.WriteLine ("Hello World!");
}
}
}
HelloWorldAddin.addin.xml
<Addin>
<Dependencies>
<Addin id="HelloWorld" version="1.0" />
</Dependencies>
<Extension path = "/Commands">
<Command class="HelloWorldAddin.HelloCommand" />
</Extension>
</Addin>
Ideally, I should be getting a message on my console saying "Hello, World",
but instead I get the above mentioned exception message. I am running .NET
4.0.
Please let me know if you have any idea what the problem is. Any help with
the above would be greatly appreciated!
Joonu
--
View this message in context: http://mono.1490590.n4.nabble.com/Problem-with-Mono-Addins-tp4515869p4515869.html
Sent from the Mono - General mailing list archive at Nabble.com.
More information about the Mono-list
mailing list