Tags
Automation, AX, AX 2012, AX Artifacts, AX Build, AX Deployment, AX Import, AX Label, Build Scripts, CIL, Compile, Dynamics AX, IL, PowerShell, R2 CU7, Synchronize
I apologize for the extra week between posts. It has been a lot of work to get this function ready to post. I built the D2DDynamics PowerShell module using cleaned up functions that were based off of the original functions I used to create my build. Even though I tested all of the functions as I built them, my actual build was still using my old functions. Getting my new build ready required me to bring my module into my build environment and re-write and re-test my build. I also wanted to get at least one build done in my environment using the new function before posting it. Hence, the extra week.
I’m not going to get too in depth regarding the function this week. I am making it available so people can look at it and try and get an idea of what I’m doing. I will be covering the specifics of it in future posts. Also, I will not be including it in the module. It is possible that a large percentage of users will be able to use the function as-is to create a build but some users will need to modify it to make it work for them and all users will need to modify the variables. You should add the function to your session using your profile.
I have also updated the D2DDynamics module to version 1.0.1. This release includes some documentation changes, a new Comment parameter for the Sync-AXTFSWorkingFolder function and I’ve exposed the Send-Email function because I use it in the Build-AXModel function that isn’t part of the module. To use the Build-AXModel function, you will need to download and setup the latest version of the module (1.0.1).
The Build-AXModel custom PowerShell function takes 3 parameters:
- BuildNumber (The build identifier)
- ConfigPath (Client configuration for the AX build environment)
- VariablePath (Path to a file used to default the parameters/variables)
All 3 variables should be used, although you could specify the ConfigPath in the Variable path file if you’d like. I have defaulted both values in the function that I use already to make my life simpler. Feel free to do the same thing in the function that you use. This function is not designed to be used “out-of-the-box”. You can customize the defaults and you will need to customize the Build-AXModel_Variables file that is used for the VariablePath parameter for this function to work. I will get into what/why/how to use the variables in a later post. For now you can look at the 2 files (Function_Build-AXModel.ps1 and Build-AXModel_Variables.ps1) and get an idea for what is going on.
There are 15 basic steps to the build:
- Sync TFS and set the label using Sync-AXTFSWorkingFolder
- Stop the AOS
- Restore the build environment to vanilla using Restore-AXDatabase
- Create the new models
- Delete the old artifacts using Clean-AXArtifacts
- Start the AOS (Build environment is now clean and ready for the new build)
- Generate the combined .xpo files using Combine-AXXPO
- Import label files using Import-AXLabelFile
- Load the combined .xpo files using Import-AXXPO
- Compile and load the VS projects using Start-AXMSBuildImport
- Compile the AOT using Start-AXBuildCompile and Compile-AXXppNode
- Compile CIL using Compile-AXCIL
- Sync the data dictionary using Sync-AXDB
- Reload the AX artifacts using Clean-AXArtifacts (This step helps with label file issues when pushing the model)
- Export the model file