Hi,
I am new to Microsoft Navision and currently using Navision 2013 R2 demonstration copy. I was trying to create a POC for calling a ".Net framework Types from C/AL code". Firstly I have written a sample class with some basic properties and methods which doesnt do much but simply return some data. Below is my class defination
using System;
namespace TestDotNet
{
public class TestInstanceObjects
{
public int ID;
private string name;
public string Name
{
get { return name; }
set { name = value; }
}
public TestInstanceObjects(string paramname)
{
name = paramname;
}
public string Getname()
{
return name;
}
public static string GetTime()
{
return DateTime.Now.ToString();
}
public TestInstanceObjects()
{
}
}
}
After this I have copied the dll to path "C:\Program Files (x86)\Microsoft Dynamics NAV\71\RoleTailored Client\Add-ins" and then proceeded to create a new page which define an object of type TestinstanceObjects and then in my InIt() event i am trying to create the object for the class by calling the constructor function using below code
obj := obj.TestInstanceObjects('Test Name');
But it always gives me an error "Cannot create an instance of the following .Net framework object: assembly TestDotNet version 1.0.0.0, culture:neutral,public key toke: null type: TestDotNet.TestInstanceObject"
In the same page I have tried creating an object from XMLDocument class defined by the framework from GAC as shown in the MSDN sample and it perfectly worked but when i try the same for my custom class it doesn't works.
I have tried creating strong name key for the dll, adding the dll into GAC, calling the code in OnRun function of a CodeUnit and then running it from a page, removing all code from the class except the default constructor to see if i am doing anything wrong in defining my class but nothing worked.
Can anyone help me in guiding me in the right direction to find what i am missing over here.
Thanks for the help
*This post is locked for comments