This is the fourth article in my series about setting up and working with your Dexterity Development Environments.
If you have not read the previous articles, please do so first using the links below:
- #Dexterity Development Environments – Part 1: Installation
- #Dexterity Development Environments – Part 2: Setting up Projects
- #Dexterity Development Environments – Part 3: Single Code Base
Disclaimer: This is the Musgravion principles of development machine setup. It is not the only method but it has worked for me for many years and has been fine tuned during my career. Feel free to use it if it works for you.
In the previous article we discussed working on multiple version of your project at the same time and maintain a single code base. In this article we will cover automating the chunking process and backing up.
Distributing your code
Once your code has been developed and tested using Dexterity’s Test Mode, the next step is to prepare it for distribution by creating a chunk dictionary file. We are assuming that you already have your Microsoft assigned Product ID for this project.
The steps below do not include the detailed steps for creating a chunk file, if you need more information on this step see the Knowledge Base article (KB 894700) I wrote (link below).
- Compile the entire dictionary to make sure that all scripts compile without errors.
- Make sure that all resources have been checked in to your source code repository.
- Delete your development dictionary (it will be in the recycle bin, if needed). Replace it with a clean Dynamics.dic dictionary renamed to the same name. Update (with Index file) from the repository to bring all resources back into the dictionary and let it compile. Note: This step is optional when working as a single developer but is good practice as it removes unused resources and confirms that the repository contains the full working code.
- Update the Index File so that any newly added resources will have a fixed resource ID from this point onwards.
- Now you can exit Dexterity and create a the chunk file.
Automating creating a Chunk File
The following stages only need to be completed once to set up the automation of the chunking process:
- When you first create the chunk file record a macro of the process so you can use the macro to repeat the steps. Don’t worry if you make mistakes or need to make changes, you can always edit the resulting macro file using notepad.exe.
- Here are the suggested naming conventions for you to use when creating the chunk file. These naming conventions follow on from the conventions used in the previous articles. The Alt Filename shows a naming convention that is used by some developers:
File Type Filename Alt. Filename * Macro File of chunking** Project.mac Extracted Dictionary** Project.dic Launch File DYNAMICS.DIC Custom Forms Dictionary Proj_FRM.dic ProXXXXF.dic Custom Reports Dictionary Proj_RPT.dic ProXXXXR.dic Chunk Dictionary** Project.cnk Dictionary Project.dic * where XXXX is a placeholder for the Product ID.
** When a folder is required, use the Project Folder where your development dictionary is.
Note: Keep all filenames to the 8.3 short file names, use of long file names will cause the chunk to fail to extract. - Once the macro has been recorded you can edit it with notepad.exe and add the following as the second line below the # DEXVERSION line to stop the macro displaying a dialog on completion:
Logging file none
Then as the last line of macro add the following line to exit Dexterity Utilities:
MenuSelect title File entry Exit
- Edit the properties of the _Dexterity Utilities XX.00 shortcut. In the Target field add a space and then the full path to the chunking macro file and click OK. So the full Target field should be something like:
C:\DexXX00\DexUtils.exe C:\DexXX00\Project\Project.mac
- Use the _Dexterity Utilities XX.00 to launch Dexterity Utilities and have it automatically create your chunk file using the macro file.
From now on, creating a chunk is just a matter of double clicking on the shortcut. If you need to update version and build numbers you can simply edit the macro file with notepad.exe.
Backing up
The final step for this article is to backup your development environment. I use WinZip and have the command line extensions loaded and have added the WinZip folder into the Environment Variable for Path. You can use any archive tool as long as it can be called from the command prompt.
I also use a command called sike.exe to delete files and place them into the recycle bin. The download link for sike.exe is no longer working, but you can use this recycle.exe command instead. If you don’t want to use a third party command, you can just delete using the standard del command.
I use two batch files to create two zip archive files. The first one, MAKEZIP.BAT zips up all the files needed to distribute the product and can be used to send files to a client. The second one, BACKUP.BAT zips up all the development files and anything not included in the first archive. Unzipping both files into a empty Project folder will restore the full development environment.
I keep a copy of both zip files in the project folder, and also copy them to a backup folder. Recently I have also been copying them to a OneDrive synchronized folder so I have a copy automatically uploaded to the cloud as well.
In the examples below you will need to perform the following Find and Replaces to set it up for your project.
Object | Find |
Dexterity Folder | DexXX00 |
Project name (for folder and files) | Project |
Project name (short version) | Proj_ |
Windows User (for OneDrive folder) | <USER> |
Also you can change the commented out lines to change whether to use del, sike or recycle for deleting files.
MAKEZIP.BAT
C: cd \DexXX00\Project if exist Proj_Dyn.idx del Proj_Dyn.idx if exist Proj_Dyn.dat del Proj_Dyn.dat if exist ..\Data\Proj_Dyn.idx del ..\Data\Proj_Dyn.idx if exist ..\Data\Proj_Dyn.dat del ..\Data\Proj_Dyn.dat rem if exist Project.zip del Project.zip rem if exist Project.zip sike -f Project.zip if exist Project.zip recyle Project.zip wzzip -ex Project Project.cnk Project.txt Application*.* rem wzzip -ex -rP Project Addins\*.dll if exist C:\Backups\DexXX00\*.* copy Project.zip C:\Backups\DexXX00\ if exist C:\Users\<USER>\OneDrive\Backups\DexXX00\*.* copy Project.zip C:\Users\<USER>\OneDrive\Backups\DexXX00\
BACKUP.BAT
C: cd \DexXX00\Project if exist Project.idx del Project.idx if exist Project.dat del Project.dat if exist Proj_Dyn.idx del Proj_Dyn.idx if exist Proj_Dyn.dat del Proj_Dyn.dat if exist ..\Data\Project.idx del ..\Data\Project.idx if exist ..\Data\Project.dat del ..\Data\Project.dat if exist ..\Data\Proj_Dyn.idx del ..\Data\Proj_Dyn.idx if exist ..\Data\Proj_Dyn.dat del ..\Data\Proj_Dyn.dat rem if exist Proj_Dyn.zip del Proj_Dyn.zip rem if exist Proj_Dyn.zip sike -f Proj_Dyn.zip if exist Proj_Dyn.zip recycle Proj_Dyn.zip wzzip -ex Proj_Dyn Proj_Dyn*.* Project.dic Project.mac *.bat dex.ini *.lnk Microsoft*.dll rem wzzip -ex -rP Proj_Dyn Addins\*.* if exist C:\Backups\DexXX00\*.* copy Proj_Dyn.zip C:\Backups\DexXX00 if exist C:\Users\<USER>\OneDrive\Backups\DexXX00\*.* copy Proj_Dyn.zip C:\Users\<USER>\OneDrive\Backups\DexXX00\
You will also notice the commented lines referring to the Addins folder, this shows an example of how to backup additional folders and would become more important when you have folders for Visual Studio Tools Addin dlls that go with your Dexterity code or folders for a Windows installer program (I use InstallAware).
For more information, see the KB Articles I created on the topic:
- How to set up the development environment when you use Dexterity in Microsoft Dynamics GP (KB 949622)
- How to create a chunk file in Dexterity in Microsoft Dynamics GP (KB 894700)
Stay tuned for the next article on creating Dictionary Assemblies.
David
This article was originally posted on http://www.winthropdc.com/blog.
4 thoughts on “#Dexterity Development Environments – Part 4: Creating Chunk Files”