Pieter van der Westhuizen

Introducing Designer for Visual Studio WiX Setup Projects

I’m sure by now you are all aware that Microsoft removed all Visual Studio Installer project types with the release of Visual Studio 2012. A suggested alternative to creating setup files was to use the very powerful and flexible WiX toolset.

The one big problem, with switching over to WiX for your setup project was that, a lot of people already invested a considerable amount of time building a setup using the Visual Studio Installer project. Completely rebuilding the setup using WiX was something not many people were looking forward to and understandably, are very upset about.

VDProj to WiX Converter

Add-in Express came to our rescue in this scenario by providing us with a great, although subtle, add-in for Visual Studio called the VDProj to WiX Converter. This little gem enabled developers to convert their existing VDProj setup projects with one click.

VDProj to WiX Converter lets you convert your existing VDProj setup projects with a click

Designer for Visual Studio WiX Setup Projects

A couple of months later, WiX has become the new ‘norm’ and everyone was happy, right? Well, yes and no. Although WiX is great, you need to build the setup using XML and it can be both a time consuming and error prone activity.

I for one, have gotten used to quickly and easily building my setup projects using the old Visual Studio VDProj projects and I’m sure so too have many other developers.

Once again, Add-in Express stepped up to the plate and came to the assistance of many developers by building the Designer for Visual Studio WiX Setup Projects (aka WiX Designer)!

How does the WiX Designer work?

When you create a new WiX setup project, the Designer adds some rather familiar looking buttons to the Visual Studio Solution Explorer toolbar:

WiX Designer adds a few familiar looking buttons to the Visual Studio Solution Explorer toolbar that launch editors for your setup

These buttons launch the following editors for your setup (from left to right):

  • File System Editor
  • Registry Editor
  • File Types Editor
  • Custom Actions Editor
  • Launch Conditions Editor

Each one of these editors will sound and look very familiar if you’ve ever built a VDProj setup. Let’s take a look at each of them.

File System Editor

I’ve created a WiX setup project for an Add-in Express based Office add-in, and when I open the File System Editor of the WiX designer, you’ll see a UI similar to what we’re used to when building VDProj setups:

File System Editor

Using the File System Editor, you can create folders, add files and even create shortcuts on the target machine when installing your application or add-in.

Using the File System Editor you can create folders, add files and create shortcuts

When you open the WiX source file (Product.wxs) you’ll see that the Add-in Express WiX Designer automatically adds and adjusts the file when you add or change any values in the File System Editor. For example, I’ve added a SaveFiles folder and a readme.txt file and the result in the Product.wxs file looks like this:

<Directory Id="dir_A350F913_7106_4915_9488_7728649643A8" Name="SaveFiles">
  <Component Id="comp_D5624607_6871_4F80_986A_4F90B4912B3C" 
             Guid="CB5BAD02-CF14-41FE-A8DF-A48A25B6DA11" Permanent="no" 
             SharedDllRefCount="no" Transitive="no">
    <File Id="_28C09903_FEA8_4570_8A19_29B7C7B1BD9D" DiskId="1" Hidden="no" 
          ReadOnly="no"TrueType="no" System="no" Vital="yes" Name="readme.txt" 
          Source="C:\Deployment\readme.txt" KeyPath="yes" />
  </Component>
</Directory>

Registry Editor

The WiX Designer registry editor also works in a similar fashion as the VDProj registry editor. You can add new keys to any one of the Windows registry hives and add several of the following values to the key:

  • String value
  • Environment String value
  • Binary value
  • DWORD value

Registry Editor

As you add and update keys and values in the registry editor, the WiX designer will automatically update and add the necessary components and values to the WiX Source file. For example the changes illustrated above will look like the following in the Product.wxs file:

<ComponentGroup Id="RegistryGroup">
  <Component Id="_95E2E288_8967_4561_97A4_63C96CC39D08" Guid="399DDAF0-B88F-473C-BAEB-04D9707FC5EF" 
             Transitive="no" Directory="TARGETDIR">
    <RegistryKey Root="HKLM" Key="My Cool App" ForceCreateOnInstall="no" ForceDeleteOnUninstall="no" />
  </Component>
  <Component Id="_E75F8BF5_5B76_43CC_9D01_B2954DFD11D0" Guid="6F0A6801-9B5F-4AF6-9E31-F59F8DD1A59D" 
             Transitive="no" Directory="TARGETDIR">
    <RegistryValue Root="HKLM" Key="My Cool App" Type="string" Name="SerialNumber" Value="1234567" />
  </Component>
</ComponentGroup>

File Types Editor

Using the WiX Designer’s File Type Editor you can specify file associations on the target computer as well as verbs to identify the actions allowed for the file type.

File Types Editor

When adding a file type, a dialog window will open with which you can select the file from either the Application Folder or the User’s Application Data folder. Once selected it will be added to the list of file types in the Fie Type editor and you can specify additional actions for the file type.

Again, as with the other WiX Designer designers the Product.wxs file will automatically be updated with the correct values and components:

<Directory Id="dir_A350F913_7106_4915_9488_7728649643A8" Name="SaveFiles">
  <Component Id="comp_D5624607_6871_4F80_986A_4F90B4912B3C" Guid="CB5BAD02-CF14-41FE-A8DF-A48A25B6DA11" 
             Permanent="no" SharedDllRefCount="no" Transitive="no">
    <File Id="_28C09903_FEA8_4570_8A19_29B7C7B1BD9D" DiskId="1" Hidden="no" ReadOnly="no" 
          TrueType="no" System="no" Vital="yes" Name="readme.txt" 
          Source="C:\Deployment\readme.txt" KeyPath="yes" />
    <ProgId Id="My Cool App Text File" Advertise="yes">
      <Extension Id=".txt">
        <Verb Id="open" Command="&amp;Open" Sequence="1" />
      </Extension>
    </ProgId>
  </Component>
</Directory>

Custom Actions Editor

The Custom Actions Editor allows you to specify custom actions during certain stages of the setup process. Each custom action can be customized by selecting it in the WiX designer’s Custom Actions Editor and changing the properties using the Visual Studio properties window:

Custom Actions Editor

Each custom action is automatically added to the WiX source file in the setup project, as illustrated below:

<CustomAction Id="RegisterApp" BinaryKey="adxregistrator_exe" Execute="deferred" 
              ExeCommand="/install="[INSTALLFOLDER]$(var.MyOfficeAddin.TargetFileName)" /privileges=user /returnExitCode=false" 
              Impersonate="yes" adx:VSName="Install Custom Action" />
<CustomAction Id="RollbackApp" BinaryKey="adxregistrator_exe" Execute="rollback" 
              ExeCommand="/uninstall="[INSTALLFOLDER]$(var.MyOfficeAddin.TargetFileName)" /privileges=user" 
              Impersonate="yes" Return="ignore" adx:VSName="Rollback Custom Action" />
<CustomAction Id="UnregisterApp" BinaryKey="adxregistrator_exe" Execute="deferred" 
              ExeCommand="/uninstall="[INSTALLFOLDER]$(var.MyOfficeAddin.TargetFileName)" /privileges=user" 
              Impersonate="yes" Return="ignore" adx:VSName="Uninstall Custom Action" />

Launch Conditions Editor

The last editor on our list is the Launch Conditions Editor. I’m sure you’re already familiar with the concept of launch conditions, but in essence it checks for certain requirements to be met before the installation can continue. As common use for this is to check whether the correct version of the Microsoft .Net framework is installed on the target computer.

With the Launch Conditions Editor you can add new launch conditions and also specify the condition using the Visual Studio properties grid.

Launch Conditions Editor

The WiX Designer’s Launch Condition Editor also automatically adds the necessary values and properties to the WiX Setup file (.wxs)

<PropertyRef Id="NETFRAMEWORK40CLIENT" />
<Condition Message="This application requires .NET Framework 4.5. Please install the .NET Framework then run this installer again."><![CDATA[Installed OR NETFRAMEWORK40CLIENT]]></Condition>

Wrapping up

The Add-in Express Designer for Visual Studio WiX Setup Projects is currently in BETA and you can expect much more in the future releases, including, amongst other things:

  • A User Interface Editor
  • Support for Web Setup projects

I’m hoping you’re as excited about this new product as we are, and we’re sure this will be another valuable addition to your development tool belt!

Test it now!

If you want to try the WiX Designer, you don’t need to wait for long :) Here is the download link for Beta 2: WiX Designer Beta 2 download.

You can install and activate it using this license info:

License Name: Beta 2

License Key: AXW2S-F3EDW-ACCWF-EB6XQ-787A5-KJDTA

Thank you for reading. Until next time, keep coding!

10 Comments

  • http://1.gravatar.com/avatar/ff3f93fdb148bb3965b10dc69e5d174a?s=32&d=http%3A%2F%2F1.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D32&r=G Omar says:

    La solucion se cierra y marca este error:

    Application: devenv.exe
    Framework Version: v4.0.30319
    Description: The process was terminated due to an unhandled exception.
    Exception Info: System.AccessViolationException
    Stack:
    at EnvDTE.ProjectItem.get_SubProject()
    at ..(System.Action`1, EnvDTE.ProjectItems)
    at ..(System.Action`1)
    at ..(System.Action`2, System.Action`1)
    at ..(Boolean ByRef)
    at ..GetDirectlyReferencedAssemblies(Boolean ByRef)
    at RedGate.Reflector.VsPackage.Gui.RobToolWindow.(Boolean ByRef)
    at RedGate.Reflector.VsPackage.Gui.RobToolWindow+.()
    at ..(log4net.ILog, System.Windows.Forms.IWin32Window, System.Action, System.Collections.Generic.IList`1)
    at ..(log4net.ILog, System.Windows.Forms.IWin32Window, System.Action)
    at RedGate.Reflector.VsPackage.Gui.RobToolWindow.(System.Action)
    at RedGate.Reflector.VsPackage.Gui.RobToolWindow.()
    at ..()
    at ..(log4net.ILog, System.Windows.Forms.IWin32Window, System.Action, System.Collections.Generic.IList`1)
    at ..(log4net.ILog, System.Windows.Forms.IWin32Window, System.Action)
    at ?.+.(System.Object)
    at System.Threading.QueueUserWorkItemCallback.WaitCallback_Context(System.Object)
    at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
    at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
    at System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
    at System.Threading.ThreadPoolWorkQueue.Dispatch()
    at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback()

  • http://0.gravatar.com/avatar/ab4ec2858cfdf1e44dadf8c50fae314d?s=32&d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D32&r=G Dmitry Kostochko (Add-in Express Team) says:

    Hi Omar,

    Could you please send your project (or some other test project with the same behavior) to our Support team? You can find our support email address in the readme.txt file located in the product installation folder. We will try to find and fix the issue.

  • http://0.gravatar.com/avatar/009bdb049c3cd08db7434d9a577f4e76?s=32&d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D32&r=G Paul Johnson says:

    Hi there Dmitry, I am busy trying to install the Beta 1 version of your WiX Designer for Visual Studio, unfortunately I am getting the following error message

    ‘Proxy Authentication Required’

    at the ‘Just one more step to complete’ stage. Can you shed any light on this please.

    Kind Regards

    Paul J.

  • http://0.gravatar.com/avatar/ab4ec2858cfdf1e44dadf8c50fae314d?s=32&d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D32&r=G Dmitry Kostochko (Add-in Express Team) says:

    Hi Paul,

    Thank you for your interest in our new product!

    I think something is wrong with the code that connects to our activation server, it looks it does not recognize your proxy’s settings. Please choose “Manual activation” instead of automatic and use your browser to obtain an activation code. If you have any difficulties, please contact our support team and our guys will generate the activation code for you.

  • http://1.gravatar.com/avatar/b6b2df7bc748deadaa09dfda49016733?s=32&d=http%3A%2F%2F1.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D32&r=G Peter says:

    Hi,

    This will definately get me to use VS2013 which I skipped because of the missing deployment/setup tool. The WiX seems to be a good tool – I just don’t like all the configuration and this is my way out. I will probably end up buying this when it RTMs.

    I spend most of my time programmring Windows Services. But I get an error (same error *8) when trying to use this add in with Windows Services.
    ———–
    Error 1 ICE79: Component ‘com_01251E76_0E2F_45DA_B543_7A448C099CBE’ referenced in column ‘InstallExecuteSequence’.’Condition’ of row ‘_D47FCEA5_A6E1_4588_AFA1_B7F3F2F018D9.Uninstall’ is invalid. C:\Users\\Documents\Visual Studio 2013\Projects\WindowsApplication1\SetupProject1\Product.wxs 34 1 SetupProject1

    ———–

    The flow is:
    New Project > Windows Service > Add project > Wix Setup > Right click the service and Add Installer. Configure the add in > add Primary Output > Add the Primary Output to the Install, Uninstall, Rollback and Commit, and you’ll get the above mentioned error.

    From Product.wxs:
    ———–

    2]]>
    2]]>
    2]]>
    2]]>
    2]]>
    2]]>

    2]]>
    2]]>

    ——————

    Anyone?

  • http://0.gravatar.com/avatar/e1a4c2b21a5186e0b27c1c601f418b76?s=32&d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D32&r=G Pieter van der Westhuizen says:

    Hi Peter,

    Great that you like our WiX Designer product and I’m very glad it can help make your life easier! : )
    Unfortunately, the XML for your Product.wxs file was removed by our blog comment system. It does not like greater than and less than characters.

    Please repost the source of your Product.wxs file, replacing the greater than and less than characters with & gt; and & lt;

  • http://0.gravatar.com/avatar/ab4ec2858cfdf1e44dadf8c50fae314d?s=32&d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D32&r=G Dmitry Kostochko (Add-in Express Team) says:

    Hi Peter,

    I have just tried to create a WiX setup project containing a Windows Service project following your steps. The project builds successfully on my side, I cannot reproduce the error. I am using VS 2013, WiX 3.8 and WiX Designer Beta 2.

    Could you please send me your project for testing? You can find our support email address in the readme.txt file located in the WiX Designer installation folder.

  • http://1.gravatar.com/avatar/b6b2df7bc748deadaa09dfda49016733?s=32&d=http%3A%2F%2F1.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D32&r=G Peter says:

    @Dmitry Kostochko
    Sure thing! I’ll send you my solution. Its VS2013, VB.NET WiX3.8, WiX Designer BETA 2.

    @Pieter van der Westhuizen
    Its okay! I think Dmitry will be looking into it :)

  • http://1.gravatar.com/avatar/1b31c1616833ef9a8613fd4da7252e07?s=32&d=http%3A%2F%2F1.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D32&r=G adiver says:

    When choosing Add>Project Output…, take the correct project in the project combobox and select Primary Output it will only take the exe and the config file but all other assemblies which are also needed are not taken.
    How is it possible to configure to take also all the dependent assemblies?

  • http://0.gravatar.com/avatar/ab4ec2858cfdf1e44dadf8c50fae314d?s=32&d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D32&r=G Dmitry Kostochko (Add-in Express Team) says:

    Hi Adiver,

    Thank you for your interest in our new product!

    We have already discussed this issue and will try to implement a feature that will add all dependencies automatically. As for now, you have to add the required assemblies manually by using the Add -> File… context menu item. Sorry for the inconvenience.

Post a comment

Have any questions? Ask us right now!