0

I have created a simple control add-in for Dynamics NAV/BC and I'm having some trouble with it. I have done exactly the same (as far as I can tell) in this add-in, as I have done in previous add-ins I have created of the same type, which have worked just fine.

The problem is that when the add-in assembly is added to a page (personally I don't know much about this part, I'm just watching as it is being done), the events and methods of the add-in are supposed to appear (stub code should be generated), however this is not the case... Nothing happens.

When they try with a similar assembly (same framework, same kind of interface, same version of 'Microsoft.Dynamics.Framework.UI.Extensibility' assembly - in short a very much similar assembly) the code for the methods and events is generated as expected.

So my question is, obviously, why is it working for one assembly and not the another, when they are next to identical in the C# code?

Here is the code for the assembly not working.

using Microsoft.Dynamics.Framework.UI.Extensibility;

namespace Dynamics.NAV.CR
{
    [ControlAddInExport("Dynamics.NAV.CR")]
    public interface ICRAddIn
    {
        [ApplicationVisible]
        event ApplicationEventHandler AddInReady;

        [ApplicationVisible]
        event DataEventHandler ButtonClicked;

        [ApplicationVisible]
        event DataEventHandler ElementHtmlRetrieved;

        [ApplicationVisible]
        event DataEventHandler ElementTextRetrieved;



        [ApplicationVisible]
        void setElementHtml(string control_id, string html);        

        [ApplicationVisible]
        void setElementText(string control_id, string text);

        [ApplicationVisible]
        void setElementCss(string control_id, string css);

        [ApplicationVisible]
        void addElementCssCls(string control_id, string cls);

        [ApplicationVisible]
        void removeElementCssCls(string control_id, string cls);

        [ApplicationVisible]
        void setElementProp(string control_id, string prop_name, string prop_value);
    }
}

What am I missing?

The person deploying the assembly says he has made sure it's 'unblocked', so that shouldn't be the issue.

I forgot to add the code for the custom event handler - here it is.

namespace Dynamics.NAV.CR
{
    public delegate void DataEventHandler(object data);
}
Aidal
  • 799
  • 4
  • 8
  • 33

1 Answers1

0

Ok, it turns out that the apparent reason that things wasn't working out for me was due to the Dynamics NAV/BC UI extensibility assembly Microsoft.Dynamics.Framework.UI.Extensibility being of a different version than the target system, or at least that is what I believe was the reason. I have tried many different things to tweak the project in order to make it work and it seems that changing this assembly did the trick.

I can't be a 100% sure though, since I have not been deploying my assembly to NAV personally and so I don't know whether or not the appropriate amount of service restarts, cache clearings and what ever else of odd required actions has taken place.

So until proof of something else being the cause to my problems emerge, I will assume that it was an assembly version mismatch that was the cause.

Aidal
  • 799
  • 4
  • 8
  • 33