Tags
Automation, AX, AX 2012, Build Scripts, Combine XPO, Dynamics AX, PowerShell, Team Foundation Server, TFS, XPO
The Combine-AXXPO custom PowerShell function will create a single .xpo file from a directory containing .xpo files. It is used in my build process to take the .xpos that are in TFS and combine them into a single file for import by model.
This is a fairly simple function that calls the Combine XPO tool. As of AX 2012 R2, this tool is available in the Microsoft Dynamics AX\60\Management Utilities folder. If you have been following my earlier posts, the path for the location is included in your profile already with .”C:\Program Files\Microsoft Dynamics AX\60\ManagementUtilities\Microsoft.Dynamics.ManagementUtilities.ps1″. If you are using a version of AX earlier than 2012 R2, you will either have to add the tool here or include the location where it is in your profile.
This parameter takes between 2-11 parameters:
- XpoDir (The directory holding the .xpos to be combined)
- CombinedXpoFile (The output .xpo file)
- SpecifiedXpoFile (A file that specifies which .xpos to combine)
- NoDel (Allows DEL_ fields to be included for objects specified in the file)
- utf8 (Sets the encoding of the output file to utf-8)
- Threads (Specifies the number of threads to use for processing)
- ExclusionsFile (A file that specifies which .xpos not to combine)
- ViewsOnlyOnce (A parameter that can increase performance at the cost of reference errors)
- SMTPServer (SMTP server to use to send the email)
- MailMsg (Net.Mail.MailMessage object used to send the email)
- 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
- Generate the CombineXPOs.exe call based on the parameters passed
- Run CombineXPOs.exe
- Send the success/fail message
HI John,
I’ve started using your powershell scripts to create an automated build process for our 2012 R3 CU8 development. We have custom code in a custom model. When I use the -Model param on the Import-AXXPO function, it seems to only recognize the model if I use the numeric ModelId number. I have tried using the ModelName, the DisplayName, and even the manifest file using “-model=@manifestFile.xml” Is this intentional or is it something I’m doing wrong, or a potential improvement?
Thanks,
-Thomas
LikeLike
Thomas,
The -Model parameter for the Import-AXXPO function is being used as a command line parameter for ax32.exe. You can find the description at https://technet.microsoft.com/en-us/library/aa569653.aspx. It passes the parameter to the Start-AXAutoRun function to be used for the client call. I have only tested this function on kernel version AX2012 R2 CU7. This kernel version allows me to pass in the “Model name” found by navigating to Tools -> Model management -> Models installed. This value corresponds to the SysModelManifest.Name table field, although it appears that it also matches the “DisplayName” field on this table as well so I’m not sure which is actually used to determine it. It is possible that Microsoft changed how this parameter is being used in R3 or even in CU8. If this functionality is working using the “Model ID” (SysModelManifest.Model field, I believe) then I would recommend that you use that to specify the model. The Model parameter is only necessary if you have multiple models and want to determine which one the .xpo is imported into. If you don’t pass it, AX should import into the default Model specified for that layer based on user settings.
LikeLike
Pingback: D2DDynamics custom PowerShell module | Day 2 Day Dynamics
Pingback: Build-AXModel custom PowerShell function | Day 2 Day Dynamics