[Mono-list] Problem with Mono.Addins

Alan alan.mcgovern at gmail.com
Thu Mar 29 18:38:38 UTC 2012


Hi,

You need to clear an ExtensionPoint so that Extensions can use it. See
http://www.mono-project.com/Introduction_to_Mono.Addins#A_simple_example

Alan

On 29 March 2012 16:51, Joonu <joonu.thomas at polarisft.com> wrote:

> 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.
> _______________________________________________
> Mono-list maillist  -  Mono-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-list
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ximian.com/pipermail/mono-list/attachments/20120329/095791c9/attachment.html>


More information about the Mono-list mailing list