, , , , , , , , , , ,

This has been an extremely difficult blog post for me to write.  I have been struggling with it because I realized that I didn’t really understand the process that I was using to accomplish my VS project import.  I took an extra week to research it and hopefully write up something useful and I have actually discovered that my process may not work for a lot of people.

I am using the ImportVSProjects.proj with msbuild.exe that I found in the Dynamics AX Build Scripts.  This project is passed into msbuild.exe with parameters that allow it to loop through a TFS directory and import the found VS projects into Dynamics AX 2012.  I have since discovered that there can be issues with projects that have dependencies on AX objects or other VS projects.  I personally don’t work in an environment that has complex dependencies, so I’ve never run into any of these issues.  There are other solutions that involve using the autorun.xml to call SysTreeNodeVSProject::ImportProject and compile for a specific AOT node.  I will be exploring these in future posts but the current method is the one I use.

The Start-AXMSBuildImport function takes between 1-14 parameters:

  • ConfigPath (Client configuration for the chosen AX environment)
  • MSBuildPath (The folder location of msbuild.exe)
  • ImportVSProjectsFile (The ImportVSProjects.proj file to use)
  • ModelFileFolder (The TFS working directory location for the Model that has VS projects to import)
  • Layer (The layer to import the VS projects into)
  • LayerCode (The license code for development in the layer)
  • ModelName (The model to import the VS projects into)
  • BuildLogFolder (Specifies the log folder location.  Defaults to $env:TEMP.)
  • DetailedSummary (Parameter for msbuild.exe that creates a detailed summary in the log file.)
  • Verbosity (Parameter for msbuild.exe that allows you to set the level of logging)
  • Timeout (The value defaults to 30 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)
  • VariablePath (Path to a file used to default the parameters/variables)

This function and the ImportVSProjects.proj can be found in Codeplex.  The steps of this function are:

  • Load the variables if a VariablePath parameter is used
  • Build the log files
  • Set up the arguments for the msbuild.exe call
  • Call msbuild.exe to import the projects
  • Send the success/fail message

I have also been cleaning up some of my PowerShell functions in preparation for putting them into a module.  I have made slight changes for uniformity and incorporated some suggestions from other AX users.  I have also incorporated my changes in the latest version of the DynamicsAXCommunity module (0.3.4).  I also have hopes that the next version will support my module with no customizations.  I will be updating past blogs posts in the near future to support my changes.