Tags

, , , , , , , , ,

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