How can i use .net class in NAV

Hi everyone,

I am new to nav developement. I have vaery simple Question, I Made a simple class liabrary in .net that is as follows:

namespace test
{
public class Class1
{
public int myVar { get; set; }
}
}

and build it and complied dll paste on the folder

“C:\Program Files\Microsoft Dynamics NAV\100\Service\Add-ins”

but when i create a variable in NAV of type dotnet then i am not able to see this class liab.

please suggest if i am doing wrong. or how can i do this ??

Hi Sahil,

You need to also copy the dll to the add-in library in the client folder on the machine where you do your development.
“C:\Program Files (x86)\Microsoft Dynamics NAV\100\RoleTailored Client\Add-ins”

Hi Alex
i have resolved this problem. now i am able to access the class in NAV. but now again confuse, some of dll are pasted on the path “C:\Program Files\Microsoft Dynamics NAV\100\Service\Add-ins” and the are easily asseble in NAV but why my dll liab is need to paste on this path “C:\Program Files (x86)\Microsoft Dynamics NAV\100\RoleTailored Client\Add-ins”?

what is the reason behind that?

and i modified my class that liab and that is :

namespace test
{
public class Class1
{
public int myVar { get; set; }
public Int32 getSum(Int32 varNum1, Int32 varNum2)
{
return varNum1 + varNum2;
}
public Int32 getNum(Int32 a)
{
return a;

}

public int getInteger(int a)
{ return a;
}
Int64 a;

}
}

and in NAV i wrote in code unit
OnRun()
varNum1 :=varNum1.Class1;
varNum2:=15;
varNum2 := varNum1.getInteger(varNum2);
MESSAGE(‘THe Number is :%1’,varNum2);

variable declartion

varNum1 DotNet test.Class1.‘test, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null’
varNum2 Integer
varNum3 DotNet System.Int16.‘mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089’

it is compiled successfully,but i run this codeunit it gives error “A call to test.Class1.getInteger failed with this message. the type of one or more arguments does not match the method’s paramerter type”.

can you suggesst me something on that…ALL is on NAV2017