AOT, Automation, AutoRun, AX, AX 2012, Build Scripts, Compile, Dynamics AX, PowerShell
The Compile-AXXppNode function is the first of 2 functions to support more complicated VS project scenarios. I have taken this approach from here. I don’t personally use this approach in my build as my current environment doesn’t require it but this function along with my next post should allow a user that does have these complicated scenarios to import VS projects for a build.
This function can return the compile results in an email but it requires a code change in the SysAutoRun.execCompileApplication() class method. When compiling everthing, the SysCompileAll::compile() class method calls the SysCompilerOutput::exportLog() class method. This exports the log to the user’s “C:\Users\..\Microsoft\Dynamics Ax\Log\” folder. If you want this log to be available, you need to add the SysCompilerOutput::exportLog() class method call to the node compile section of code. I realize that this is a chicken and egg type thing as this custom code would need to be imported into the build environment before importing and compiling VS projects but it is possible to implement.
The AutoRun xml does have the ability to specify a log file as well but this log file will only show you what nodes were compiled. There is no message regarding the results of the compile in it. Because of this limitation, I didn’t used this log in the function.
The Compile-AXXppNode custom PowerShell function takes between 2-7 parameters:
- ConfigPath (Client configuration for the chosen AX environment)
- Node (The AX node to compile)
- Timeout (The value defaults to 90 minutes but can be overridden if desired)
- SMTPServer (SMTP server to use to send the email)
- MailMsg (Net.Mail.MailMessage object used to send the email)
- AXVersion (The AX version. It defaults to 6.)
- VariablePath (Path to a file used to default the parameters/variables)
This function can be found in Codeplex. The steps of this function are:
- Load the variables if a VariablePath parameter is used
- Get the AX environment info using Get-AXConfig
- Get the Compile node AutoRun xml using the Get-AXAutoRunXML function
- Call the Start-AXAutoRun function to compile the node
- Send the success/fail message
As I said in the last post, I have been in contact with Martin Drab. He is developing the DynamicsAXCommunity PowerShell module that I piggyback off of. He has incorporated the last change that I needed for my functions to work in the latest build of the module (0.3.5). I haven’t tested it out yet, but my functions should now work with his module with no customizations.