New extension: Copy/Move with Base Point

Many drawing products feature so-called base point operations. In particular, AutoCad has Copy with base point, Move with base point. This operation may be quite useful for precise positioning of the content being copied/moved. To achieve this, at the first step a base point is selected, and on the second step a new position for this base point is selected. Check out this video to see how it works:

Go to the Extension\’s page

VisioWixSetup 1.2 – now with full functionality of Solution Publishing

A milestone of the VisioWixSetup project I’ve been working on – now it can be used to publish anything Visio Solution Publishing Tool could publish, and Visio could understand =)

The changes in this version:

– Added support for publishing ADDONS (EXE/VSL) and help files.
– Fixed an issue with x64 install
– Simplified “starter” wxs file.
– Created project page (with detailed information about all supported attributes)
– Added tests to verify correctess of generated installer.

The new project page

Visio Wix Installer Project Template

This project was migrated over time to "Extended Visio Add-In" (open-source), now it is a part of it. Check it out at the marketplace

The WiX project template for Visio allows you to create an installer for installing Microsoft Visio content (stencils, templates, VSL and EXE add-ons, help files).

This project brings the functionality of Visio Solution Publishing tool from Visio SDK into WiX, so now you can author setup which includes registration (publishing) of Visio-related stuff completely in WiX.

Check it out in Visual Studio gallery:

 11-05-2013 4-19-38

To add Visio publishing to your files to the installer, you can just use one of <visio:Publish > wix extension elements (nest under <File> element). The wizard creates a "starter" sample wix file to build your installer, with two sample Visio files – a template and a stencil.

Continue reading“Visio Wix Installer Project Template”

Improved Visio WiX Setup (version 1.1) – Compiler Extension

I have improved the WiX project template by creating a real WiX compiler extension.
That is, now you can register Visio files with WiX like this (minimalistic example includes just one extra line to publish file):

          <Component>
            <File Name="Stencil_1_M.vss">
              <visio:Publish MenuPath="Group\Stencil 1"  />
            </File>
          </Component>

The updated version is available in Visual Studio Galery:
http://visualstudiogallery.msdn.microsoft.com/68d12e2d-eb42-4847-808a-7d80863bb90d

Continue reading“Improved Visio WiX Setup (version 1.1) – Compiler Extension”

Visio WiX Setup project in Visual Studio Galery

The Visio Wix setup project was improved a bit. To simplify things, I’ve published it as a project template for Visual Studio in Visual Studio Galery. This is the first time I publish anything in Visual Studio Galery, so that was a bit interesting how to make the wheels rolling:

11-05-2013 4-19-38

In fact, this turned out to be rather easy actually. A good introduction how to publish stuff to Visual Studio Galery can be found on codeproject. That article gives a good  overview, how it all fits together. Anyways, the main result is that now it is possible to create an WiX-based installer project for Visio just like any other project in Visual Studio, please check out the video in the post.

Note that you must have WiX installed to be able to use this project template =)

Continue reading“Visio WiX Setup project in Visual Studio Galery”

Hans Rosling and data visualisation

Just a wonderful example of data visualization, and what can be done with diagramming.

http://www.gapminder.org/

I first encountered Professor Hans Rosling talks on TED – really exciting. For example, see the recent talk about Religions and Babies where he shows what the world population will be, or the talk "washing machines" ("Even the Hard Core of the Green Movement Use Washing Machine"). I wish I had him as a professor when I studied in Uni =)

PS. Now the technology was acquired by Google, and is is available as part of the the project Google Public Data.

Creating an installer for Visio with WiX

If you develop add-ins, templates, or stencils for Visio, sooner or later you will face the question of how to deploy them. Visio allows you to deploy your solution or template in such a way that it can be embedded nicely in the Visio user interface, appearing like all other built-in Visio templates. For Visio developers, Visio SDK provides the Solution Publishing Tool, which is an official method to publish Visio-related components. However, this tool has several limitations, including:

  • It does not integrate well into automated build processes, such as when using continuous integration with a build server.
  • It uses custom VBScript actions, which may become a problem with some antivirus programs or in very restricted environments.

file

Windows Installer XML (WiX) builds Windows installation packages from XML source code and integrates seamlessly into build processes. The toolset originates from Microsoft, which used it internally to build Microsoft Office installers. The tool is highly robust!

This post explains the magic behind the Visio Solution Publishing tool and demonstrates how you can achieve the same result with WiX. It shows how to create an installer to install templates and stencils and includes a sample/template WiX solution to install Visio files for both Visio x86 and Visio x64.

Creating an installer involves the following steps:

  • Download and install WiX (version 3.6 was used for the sample project).
  • Create a WiX project in Visual Studio.
  • Add Visio template and stencil files to the project.
  • Customize the installer by adding Visio-specific actions (the most challenging part, which this post focuses on, as the other steps are relatively straightforward and well-covered in the user manual and numerous tutorials).

So, what does the Solution Publishing Tool actually do with the installer? It fills in the "PublishComponent" Windows Installer table and triggers Visio to rebuild the template cache by modifying the ConfigChangeID registry key. You can find more information about the table in this Microsoft KB832029 and this article. Since the Visual Studio installation project is a limited tool and does not support component publishing, this gap was filled by the Solution Publishing Tool.

WiX does not impose any restrictions and provides full access to all features Windows Installer supports. This means you can author these Visio publishing rules directly in the installer without the need for the Solution Publishing Tool, allowing your project to be built in Visual Studio or from the command line, including Azure DevOps, which supports WiX builds.

Adding Visio publishing information to the WiX installer

After adding a Visio template/stencil file, your WiX project will contain something like this:

<Component Id="StencilA">
  <File Name="StencilA.vss" />
</Component>

To publish the stencil to Visio, you need to add publishing information like this:

<Component Id="StencilA">
  <File Name="StencilA.vss" />
  <Category
    Id="{CF1F488D-8D6F-499C-A78D-026E1DF38101}"
    Qualifier="1033\StencilA.vss"
    AppData="X Stencils\Stencil-A" />
</Component>

The example above publishes an English stencil (ID = GUID of stencil), named "StencilA.vss", which should be made available under the category "X Stencils" as "Stencil-A". The field values for Visio are as follows (refer to the above KB article):

Attribute Value Example
Id Fixed code For templates: {CF1F488D-8D6F-499C-A78D-026E1DF38100}
For stencils: {CF1F488D-8D6F-499C-A78D-026E1DF38101}
Qualifier LocaleID\FileName 1033\flowchart.vst. Note: You cannot use multiples of the same file name in one Visio environment. Locale-ID\FileName must be unique so that Visio can recognize it. Therefore, use a unique file name in one Visio environment.
AppData MenuPath|AltNames Flowchart\Work Flow Diagram Shapes|Work Flow Diagram Shapes.vss;workflow.vss

Further description of values:

Value Description Example
ComponentID A predefined value for the content type. For templates: {CF1F488D-8D6F-499C-A78D-026E1DF38100}. For stencils: {CF1F488D-8D6F-499C-A78D-026E1DF38101}
LocaleID The decimal locale ID of the component. Common values include: 1033 (English), 1031 (German), 1036 (French), 1049 (Russian) 1033
FileName The file name (without the path) of the template or stencil flowchart.vst
MenuPath For templates, specifies where the template is displayed in the menus. For stencils, specifies where the stencil is displayed. An empty string means it won’t appear. If an underscore (_) precedes any name, it won’t show in menus. The final portion affects the Visio UI file name. Flowchart\Work Flow Diagram Shapes.
AltNames A semicolon-delimited list of alternate names. Overrides stored alternate names by the AlternateNames property of the Document object. Work Flow Diagram Shapes.vss;workflow.vss

Triggering Visio rebuild template cache

To inform Visio that new stencils/templates were installed, trigger a cache update by modifying the registry value ConfigChangeID under this key:
HKEY_LOCAL_MACHINE\Software\Microsoft\Office\Visio.

The Visio Solution Publishing tool accomplishes this by embedding a small script to increase the ID by one:
Action "VisSolPublish_BumpVisioChangeId32"

Dim WshShell, visChangeId
Set WshShell = CreateObject("WScript.Shell")
Key = "HKLM\Software\Microsoft\Office\Visio\ConfigChangeID"
On Error Resume Next
visChangeId = WshShell.RegRead()
If Err = 0 Then WshShell.RegWrite Key, visChangeId + 1, "REG_DWORD"

With WiX, you can implement this in several ways:

  • Use the same method as the Solution Publishing tool by adding the following code to your installer:
<!-- define script action to increment Visio counter -->
<CustomAction
  Id="SetConfigChangeID"
  Script="vbscript"
  Execute="deferred"
  Impersonate="no"
  Return="check" >
<![CDATA[
    Set WshShell = CreateObject("WScript.Shell")
    Key = "HKLM\Software\Microsoft\Office\Visio\ConfigChangeID"
    On Error Resume Next
    visChangeId = WshShell.RegRead(key)
    If Err = 0 Then WshShell.RegWrite key, visChangeId+1, "REG_DWORD"
]]>
</CustomAction>

<!-- execute script action on install -->
<InstallExecuteSequence>
  <Custom Action="SetConfigChangeID" After="InstallInitialize" />
</InstallExecuteSequence>
  • Implement a custom action that does not involve scripting (see the sample solution for implementation details).

Two sample solutions have been attached for reference (templates) to build your installer. The first uses the VBScript approach (to bump ConfigChangeID with VBScript), while the second implements a custom action. The setup deploys 2 templates and 2 stencils.

https://unmanagedvisio.com/download/source/WixSolutionSetup.zip

https://unmanagedvisio.com/download/source/WixSolutionSetup_SC_Script.zip

The solutions should build an installer (x86 or x64 version depending on the selected configuration) to install templates and stencils in English and German under categories "X Stencils" and "X Templates". It should work with all Visio versions (2003 – 2013).

Installation Example

Map of Russia in Visio – version 1.0.1

Updated the recently published map:

  • Added related page to the with some pictures and video =)
    – Now all regions are stored alphabetically (yep, they were not)
    – Now you can install this template using installer (and it will show up in Visio templates – in category "Maps and Floor Plans".
  • Preview picture for the template enhanced using technique described here.

20-04-2013 22-41-20