Assume that you would like to extend the editor in Dynamics AX 2012, for example by adding the (painfully missing) brace matching. How to do that?

You must realize that although the editor looks almost the same as in previous versions, its architecture was completely changed. Now the Visual Studio editor is hosted in AX and it was just made to look like the old editor. And although the AX editor still doesn’t have lots of features, this solution allows us to use the same extensibility model as for the usual Visual Studio editor extensions.

So how to implement the brace matching? First of all, you need Visual Studio 2010 Professional (or a higher edition) and Visual Studio 2010 SDK (links below). Then you can simply follow the tutorial Walkthrough: Displaying Matching Braces. It’s written for Visual Studio and it has nothing to do with Dynamics AX, but as I said – the editor is technically still the same.

When you finish the tutorial (or download the built version), you need to take the .dll library and copy it to bin\EditorComponents folder in AX2012 client folder (e.g. c:\Program Files (x86)\Microsoft Dynamics AX\60\Client\Bin\EditorComponents). And that’s all – just start AX, open the editor and the matching braces should be automatically highlighted, when cursor is placed before the opening or after the closing brace.

By the way, the technology allowing to plug in new extensions in such a simple way is called Managed Extensibility Framework and it’s worth to take a look.

I must repeat again that Dynamics AX went through many architectonic changes, which may not to be obvious but which offer completely new opportunities. And I really missed brace matching in AX for so many years…

Links

AxBraceMatching – DLL
AxBraceMatching – zipped VS project (requires VS SDK)

Visual Studio 2010 SDK

Visual Studio 2010 SP1 SDK