How to use DLL with Ax 2012

1.open visual studio 2010 create a new C# project in that open class library write the following code

using System.Text;

namespace AXCS

{

public class TestingMyDLL1

{

public string Greet(string name)

{

return “Hello ” + name;

}

}

}

2.Bulid the solution

3.go visualstudio projects—> copy dll files

4.program files(X84)–>microsoft dynamics—>client—>bin—> paste    Dll files

5.open AOT–>go referencess —>.add reference–> add that dll files

6.Go to jobs–> Add new job write that following code

static void John_DllTest(Args _args)
{
JohnTestClassLibrary.TestingMyDLL1 testingDll;

InteropPermission permission;

str s;

try

{

permission = new InteropPermission(InteropKind::DllInterop);

permission.assert();

testingDll = new JohnTestClassLibrary.TestingMyDLL1();

s = testingDll.Greet(“Johnkrish The Great”);

info(s);

}

catch

{

error(‘Error executing DLL code’);

}

}

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s