I love writing Visio automation code, but I really don’t like writing setup & deployment scripts. There are so many variables : What Visio version, which edition? Which bitness (x86 or x64)? What are the user settings for the paths of stencils or templates?
So, I decided to write myself some C# functions that can be used in custom actions for an installation writing application, such as Advanced Installer. I think of the methods as being in one of three phases, Installation; Functionality and Configuration. The registry has three different areas to search within, Classes Root (HKCR); Local Machine (HKLM) and Current User (HKCU). In addition, the best way to get the true file version of Visio is to use FileInfo on the executable. The following screenshots are from a Cross-Functional Flowchart of the functions that get values for variables, and use them in other functions, until, eventually, the current user settings can be read.
Each of the functions I wrote handle the part of the registry that needs to be used. By that I mean that some settings for 64bit Visio on 64bit Windows will be in a different branch than 32bit Visio on 64bit Windows.
The first function gets the current version of the application associated with Visio drawings: