Tuesday, January 10, 2012

Fixing a bad XPO File for Microsoft Dynamics 2012

Ok, this my first topic entry and I can't imagine a more boring topic. Yet - it has taken some time to find a way to solve this problem so in keeping with my intent for this blog I'm posing it.

I am currently in the process of implementing Microsoft Dynamics AX 2012 (DAX) for my company (The Aagard Group). We are doing extensive customization within the system. One of the great features of DAX is that it integrates with Microsoft Team Foundation Server (TFS). To do this it exports (and imports) customization in the form of formatted text file (similar to an XML file). This allows synchronization between the individual developer environments. The text file has an extension of ".XPO".

Well, there appears to be a bug in the code that generates the .XPO file. Occasionally DAX will create a bad Project XPO file – either when explicitly exporting or when checking in changes. The problem is manifested when importing the project XPO file. It will cause a Critical Stop error with a message that says “Error in line ###: expected BEGINNODE but found FILETYPE." (see the image below)

This error unfortunately may send you on a wild goose chase looking for missing “BEGINENODE” lines. In fact, the problem is a missing  PROJECTCLASS identifier. A correct project XPO will have the project class type after the keyword PROJECTCLASS. For example a typical project will have the following line:


PROJECTCLASS ProjectNode


While a test project will have:


PROJECTCLASS SysTestProject


But the bad XPO will simply have:


PROJECTCLASS 


To fix the XPO file simply put ProjectNode or SysTestProject (depending on the type of project the XPO represents) after the PROJECTCLASS keyword.


The screen capture below shows the file prior to the fix compared to the file after the edit.


Interestingly, not every project XPO that is missing the PROJECTCLASS identifier will create the critical stop. If the nodes in the project are all contained in groups apparently the parser can recover from the missing PROJECTCLASS identifier. The screen capture below shows a project file with and without the PROJECTCLASS identifier. Both versions will import properly.

I have encountered this error seemingly randomly. I don't know what causes it I haven't found any information about anyone else complaining about it. So, hopefully this information will be helpful in future. Here's to also hoping the defect is fixed soon so this information becomes obsolete.

Tory

No comments:

Post a Comment