In the video from my previous post, I showed how to create managed proxies for X++ classes with the new Microsoft Dynamics AX2012 Visual Studio toolset.

X++ managed proxies allow you to invoke X++ code from managed code

Here is a brief recap on how to do that:

In Visual Studio, simply create a class library. In Solution Explorer, right click on the project and select ‘Add  a ClassLibrary to AOT’:

image

Then open the Application Explorer, right-click on the class you want to proxy and select ‘Add to Project’

image

This will add a proxy item to you project and give you full Intellisense on the proxied class from your managed code:

image

Now what if you want to use a kernel class such as the TreeNode? The toolset does not offer any simple gesture to add such a class to your project, but here is what you can do:

Start by adding a random X++ class as explained above. In the solution explorer, select the added proxy item and rename it by using the context menu or F2:

image

You can see that the actual name of the item is something like Class.<SomeClassName>.axproxy.

Now replace <SomeClassName> with the name of the class you want to proxy. For example, if you want to proxy the TreeNode class, you should rename the item to Class.TreeNode.axproxy.

That’s it! You can verify that it worked by checking that the class shows up in the Intellisense:

image