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…
AxBraceMatching – DLL
AxBraceMatching – zipped VS project (requires VS SDK)
Visual Studio 2010 SDK
Visual Studio 2010 SP1 SDK
I dropped the DLL you posted in the c:\Program Files (x86)\Microsoft Dynamics AX\60\Client\Bin\EditorComponents however the brace matching does not seem to kick in. Any additional steps required?
I’m downloading the SDK to compile it again to see if that makes a difference.
I’m not aware about much additional requirements. You probably need Visual Studio 2010 installed on the same machine (I didn’t test this but I expect AX2012 itself doesn’t have all necessary libraries). Also, Ax32.exe.config must contain a probing setting pointing to EditorComponents, but that’s done by default.
Definitely the best way is to build it on your machine and debug if necessary.
I have also tried it, but no luck.
Also checked the config file and indeed it should check in the editorComponents directory.
Works for me!
I’m would like to implement a feature, where a marked word is highlighted in the whole text. Like i notepad++ or when you search in Google Chrome. Very nice thing to analyze the code.
What so you think, is it more difficult than brace matching?
You can even follow another tutorial: http://msdn.microsoft.com/en-us/library/dd885121.aspx. 🙂
Can anyone explain exactly how he did it. Here it still does not work. The funny thing though is that when the client is running, I cannot overwrite the dll meaning that the client actually pick it up and holds it somehow.. but nothing happens in the editor.
Sorry guys, I don’t know where your problem lies. It works on all my machines and in the whole company, so I haven’t experienced any issues yet.
I can just recommend the usual things – EventLog, debugger attached to ax32.exe and so on.
it works fine on my machine (just dropped the dll in the editorComponents folder). Nice! 🙂
For all of you who can’t get it to work: did you unblock the assembly?
Right click the dll, choose properties, look at the bottom of the dialog and see if there is the option to ‘unblock’. Press the button and presto!