AX7 / D365: The “… not compiled with chain of command feature …” Error
When you boot up a new VM with AX >= PU 9 and try to extend the code with chain of command, chances are high that you might run right into the following error:
“The assembly which contains class ‘ClassName’ is not compiled with chain of command feature, so method ‘MethodName’ cannot use chain of command in this extension class.”
TLDR: Compile all models that you are trying to extend with the chain of command feature.
It seems like the images, that are actually in use, are not compiled with the chain of command functionality, so we have to do it on our own, when trying to use “CoC”.
Compile (all) models
Compiling models in AX7 / D365fO is pretty easy, just open Visual Studio on your machine, search for the “Dynamics 365” menu on the top and hit “Build models…”.
The “Full build” form pops up and you can select all models you want to compile.
Here I simply selected “(Select all)” which marked all packages for me. I do this on every new machine once after the first boot / setup and before starting to develop any code.
After hitting “Build”, the selected models will be build. You only have to build the model you want to extend and you have to do it only once to get rid of the “… not compiled with chain of command feature …” error.