Developing for Dynamics GP

by David Musgrave (Perth, WA, Australia) and the Microsoft Dynamics GP Developer Support Team (Fargo, ND, USA)

Microsoft Dynamics GP Home Page is dependent on Short File Names

Microsoft Dynamics GP Home Page is dependent on Short File Names

  • Comments 2

David Meego - Click for blog homepageI solved an interesting case yesterday and thought I would share the details with you.

The partner had installed Microsoft Dynamics GP 2010 R2 on a new Terminal Server and everything was working except the Home Page was not being rendered correctly.

The images were missing and showing as Red X's and the metrics were not being displayed.

The partner had already reviewed the standard Knowledge Base (KB) articles on home page issues: 

 

The information in the articles did not resolve the issue, so the partner contacted Microsoft Support for assistance.


The Microsoft Dynamics GP homepage is created using a HomePage.xml file created in the local temporary folder for the workstation. The HomePage.xml file in turn uses the HomePage.xsl style sheet and HomePage.css cascading style sheet files in the Background folder in the application folder to control how it is rendered. Finally, the images are stored in the Images folder under the Background folder.

So, I asked the partner to send me copies of the HomePage.xml file from the %TEMP% folder and the HomePage.xsl and HomePage.css files from the Background folder.

Note: You can quickly open Windows Explorer to the %TEMP% folder by selecting Start >> Run >> %TEMP%.

The Homepage.xsl and HomePage.css files are standard and I could not find any issues with them. 

I then compared the HomePage.xml file from the partner with one from my system using XML Notepad 2007. I found the value for the basehref attribute in the Page section of the XML at the top of the file was missing.

So I updated this value to match the value (as well as the location of the style sheet on the line above) from my HomePage.xml and the double clicked on the file to open it with Internet Explorer. The page now rendered correctly except for the metrics. As the metrics pointed to a report server that I don't have, it was expected that they would not work.

So, now we knew why the Home Page was not rendering correctly. With the basehref value missing, it was unable to locate the HomePage.css file and the images in the Images folder.


Below are the steps to check if the basehref value exists in your HomePage.xml. If it is missing then you might have the same issue as occurred on this case.

  1. Open the Temporay folder: Start >> Run >> %TEMP%
     
  2. Locate the HomePage.xml file, right click on it and select Edit.
     
  3. Once opened with Notepad.exe, search (Ctrl-F) for basehref and ask check the path.
     
    If it looks like the line below you have the problem:
     
    basehref="file://"
     
    The path should look like the example below (exact path depends on your system):
     
    basehref="file://C:/PROGRA~2/MIE5E6~1/GP2010/BACKGR~1/"
     
    Note: it is using the short (8.3) legacy file names and is using forward slashes for html format.

 

Looking at the Microsoft Dynamics GP Source code to check how the HomePage.xml file is generated, I found that the form level procedure XML_CreateStream of form syHomePageXML creates the basehref value in the xml document using the following code:

sPath = Path_MakeNative(Path_GetForApp(2)) + BACKGROUND + CH_BACKSLASH;
call 'GetShortPathNameA@kernel32.dll', lReturnValue, sPath, sShortPath, length(sPath);
sPath = ReplaceAllCharacters(sShortPath, CH_BACKSLASH, CH_SLASH);

This code attempts to obtain the path to the Background folder in the application install folder expressed using short (8.3) file names and with the backslashes converted to slashes. The call to GetShortPathName in the windows kernel32.dll will fail to return a valid result if there are no short file names stored in the directory structure for each folder in the path.

 

To test if the path to the Background folder in the application folder on your system has the short file names available for each folder in the path, we can run the following statements from the command prompt (this assumes you application is installed at "C:\Program Files (x86)\Microsoft Dynamics\GP2010\Background"):

dir "C:\Program Files (x86)*" /x
dir "C:\Program Files (x86)\Microsoft Dynamics*" /x
dir "C:\Program Files (x86)\Microsoft Dynamics\GP2010*" /x
dir "C:\Program Files (x86)\Microsoft Dynamics\GP2010\Background*" /x

The results for each dir statement should show both the long file name and short file name, for example:

 Directory of C:\

19/08/2012  11:05    <DIR>          PROGRA~2     Program Files (x86)

If the short file name is missing then short file names might be disabled for your system or for the drive volume.

 

Referring to the Knowledge Base (KB) article below, we can learn how to turn short file names back on using the fsutil command:

 

The following steps check the settings for 8.3 short file name creation and turn the feature on if required:

  1. To use the fsutil command we need to open a Command Prompt as Administrator.
     
    Start >> Programs >> Accessories >> Right click on Command Prompt and Run as Administrator
     
  2. To check if 8.3 short file name creation is enabled for your system, type:
     
    fsutil 8dot3name query
     
    You will get a response  that looks like one of the following:
     
    The registry state of NtfsDisable8dot3NameCreation is 0 (Enable 8dot3 name creation on all volumes).
    The registry state of NtfsDisable8dot3NameCreation is 1 (Disable 8dot3 name creation on all volumes).
    The registry state of NtfsDisable8dot3NameCreation is 2, the default (Volume level setting).
    The registry state of NtfsDisable8dot3NameCreation is 3 (Disable 8dot3 name creation on all non system volumes).
     
  3. We want the either 0 or 2, if it is set to 1 or 3, run the following command to change the state:
     
    fsutil 8dot3name set 2
     
  4. Then check the drives (system drive and drive containing Microsoft Dynamics GP application):
     
    fsutil 8dot3name query c:
     
    The results should show something similar to the example below:
     
    The volume state for Disable8dot3 is 0 (8dot3 name creation is enabled).
    The registry state of NtfsDisable8dot3NameCreation is 2, the default (Volume level setting).
    Based on the above two settings, 8dot3 name creation is enabled on c:.
     
    or
     
    The volume state for Disable8dot3 is 1 (8dot3 name creation is disabled).
    The registry state of NtfsDisable8dot3NameCreation is 2, the default (Volume level setting).
    Based on the above two settings, 8dot3 name creation is disabled on c:.
     
  5. If the volume state is 1, then run the following command to enable it:
     
    fsutil 8dot3name set c: 0
     
  6. Repeat steps 4 and 5 for other drive volumes as needed.

 

Note: These changes take immediate effect, a reboot is not required. Any folders or files created from this point onwards will have a short file name created for them.

 

However, the issue is not fully resolved yet. Existing folders and file names will not be updated to add short file names. Even if you rename a folder that does not have a short file name it will not be added.

So, to finish resolving the issue, we needed create the folder structure again so that it included the short file name at each level. Below are the steps:

  1. Start by closing all applications to get exclusive read/write access to the "C:\Program Files (x86)" folder. 
     
    Note: You might need to use safe mode to stop applications from running.
     
  2. Rename "C:\Program Files (x86)" folder to another name, for example: "C:\Program Files (x86) old".
     
  3. Create a new folder called "C:\Program Files (x86)".
     
  4. Navigate to the folder "C:\Program Files (x86)" and create a new folder called "Microsoft Dynamics".
     
  5. Navigate to the folder "C:\Program Files (x86)\Microsoft Dynamics" and create a new folder called "GP2010".
     
  6. Navigate to the folder "C:\Program Files (x86)\Microsoft Dynamics\GP2010" and create a new folder called "Background".
     
  7. Move the contents of the "C:\Program Files (x86) old" folder to the "C:\Program Files (x86)" folder and say Yes when asked about merging existing folders.
     
  8. Delete the "C:\Program Files (x86) old" folder.

Note: If the higher levels in the tree did have short names associated with them, you can start the above steps from that point onwards.

  

Now the complete path to the Background folder will have short file names at each level and the Home Page displays correctly.

That's all folks. 

David

PS: It looks like the short file name path to the Background folder is used to allow simpler referencing of the folder (without spaces) in the code in the HomePage.xsl style sheet file.

PPS: This will no longer be an issue with the upcoming Microsoft Dynamics GP 2013 release as the Home Page code has been completely redesigned and this dependency no longer exists.

Page 1 of 1 (2 items)
Comments Information

PLEASE READ BEFORE POSTING

Please only post comments relating to the topic of this page.

If you wish to ask a technical question, please use the links in the links section (scroll down, on right hand side) to ask on the Newsgroups or Forums. If you ask on the Newsgroups or Forums, others in the community can respond and the answers are available for everyone in the future.

Leave a Comment
  • Please add 8 and 3 and type the answer here:
  • Post