The Import-AXVSProject function is the second of 2 functions to support more complicated Visual Studio 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 earlier post should allow a user that does have these complicated scenarios to import VS projects for a build.
This function uses a system class to import the VS project. The AX SysAutoRun functionality allows users to call a static method of a class in AX. The AX system class SysTreeNodeVSProject has a static method called importProject() that takes an argument of a VS project file and imports it into AX.
Using the Import-AXVSProject function in conjunction with the Compile-AXXppNode function will allow you to import VS projects and compile them in any order that you need to. If you have projects that are dependent on AX code to compile correctly, you can compile the AOT or specific nodes of the AOT before importing and compiling the project. If the AX code or another VS project is dependent on the VS project, you can change that order. These functions allow you to import and compile in a manner that gives you control over order and saves time from a full AOT compile.
The Import-AXVSProject custom PowerShell function takes between 1-8 parameters:
- ConfigPath (Client configuration for the chosen AX environment)
- VSProject (The VS project to import)
- LogFile (The logfile for SysAutoRun. Has a default value so you only need to specify if you want to change the location.)
- 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
- Set up the AutoRun xml command
- Get the AutoRun xml using the Get-AXAutoRunXML function
- Call the Start-AXAutoRun function to compile the node
- Send the success/fail message
This is the last function necessary to create an automated build process. In the coming weeks I will be cleaning up my current posts to fit with some changes I have made to the existing functions and I will post a blog about putting these functions together to allow you to automate your build. I will also be releasing a module to Codeplex in the next month that will have all of the functions packaged up for easy deployment.