Total Pageviews

Search This Blog

Monday, December 31, 2007

Referencing Visual Studio 2008 Assembly from AX

Steps to reference .NET Assembly (using Framework 3.5) from AX:

1. Back to Hello World times :-). Create a .NET Assembly using Project type->Class Library which will return a hello world string from VS2008.

2. Build the solution and copy the HelloWorldLibrary.dll into \ax\client\bin directory.

3. Open AOT->References and browse to add the helloworld assembly to references node.

4. Now, create a job and refer the assembly namespace and code against it.

this is the code in job:

static void JobNetFramework35(Args _args)
{
HelloWorldLibrary.Class1 oc;
str retval;
;
oc = new HelloWorldLibrary.Class1();
retval=oc.HelloWorld();
print retval;
pause;
}

and it returns as expected,

"Hello World From VS2008 using NET 3.5 framework"

Communication with AX

I couldn't resist my hands-on to test how VS 2008 Communicates with AX using .NET Framework 3.5

The code works same and the logon was successfull as expected:


try
{
Axapta ax = new Axapta();
ax.Logon(null, null, null, null);
MessageBox.Show("Logon Successfull");
}
catch (LogonFailedException ex)
{
MessageBox.Show(ex.Message);
}

Exploring VS 2008

Just installed Visual C# 2008 Express Edition from the link below




Note: Visual Studio 2005 and Visual C# 2008 Express can co-exist in the same system.


Visual Studio 2008 has a host of new features, one I tried is Dynamic variable declaration. This is one of the language features:


Implicitly Typed Local Variables
Instead of explicitly specifying the type of a local variable, the var keyword instructs the compiler to infer the type of a variable based on the value assigned at initialization.


Thursday, December 20, 2007

xInfo API

I just stumbled upon this API as I had a requirement to extract the serial number from the license.

print xInfo::serialNo();

This will get you the serial number, It's handy. Also, it hosts some more static methods like:

buildNo
osName
releaseVersion
productName
licenseName

AXAPTA BUILD VERSION

Thanks to Axaptapedia Group for putting up this valuable information:

http://www.axaptapedia.com/index.php/Build_numbers