Showing posts with label WiX. Show all posts
Showing posts with label WiX. Show all posts

Tuesday, March 03, 2009

Generating GUIDs

This may seem trivial but here we go:

I recently created an installer with WIX and obviously had to create a number of GUIDs along the way. While there is a "Create GUID" option in the Tools menu it has a number of drawbacks:

  • Clicking around a UI with a mouse is not the most efficient thing in the world
  • There is not an immediately suitable format available, registry format is closest, but braces need to be removed and the rest uppercased

The obvious? solution to this problem is to create a macro like the following:

Public Sub CreateWixGuid()
Dim g As Guid = Guid.NewGuid()
Dim textSelection As EnvDTE.TextSelection

textSelection = CType(DTE.ActiveDocument.Selection(), EnvDTE.TextSelection)
textSelection.Text = g.ToString("D").ToUpper()
End Sub


and assign a keyboard shortcut to it (I chose Ctrl+G,Ctrl+G), and voilà a GUID in the correct format is generated and inserted.



 



 

Sunday, November 04, 2007

Integrating Help2 files into VS 2005 - part 2

The other workaround I hinted in the previous post involves a bit of manual labor the first time (or if you ask nicely, I might just provide the needed parts), if used more than once it is IMO less painful than the ORCA route.

This solution takes advantage of <CustomTable> feature of WiX. By "reverse engineering" the needed table schemas out of the relevant merge module MSHelp2_RegTables__RTL_---_---.msm we can author these tables as <CustomTable>:s and then just add <Row>:s as appropriate.

Next time just edit the row data and you're set.

For brevity, I just post one table here, but the rest can be made available upon request.

The tables I've used are HelpFile, HelpFileToNamespace, HelpNamespace and HelpPlugin.

      <CustomTable Id="HelpFileToNamespace">
<!--
HelpFileToNamespace table definition -->
<
Column
Type="string"
PrimaryKey="yes"
Id="HelpFile_"
Nullable="no"
KeyTable="HelpFile"
KeyColumn="1"
Category="Identifier"
Description="Foreign key into HelpFile table (required)." />
<
Column
Type="string"
Width="72"
PrimaryKey="yes"
Id="HelpNamespace_"
Nullable="no"
KeyTable="HelpNamespace"
KeyColumn="1"
Category="Identifier"
Description="Foreign key into HelpNamespace table (required)."/>

<!--
data -->
<
Row>
<
Data Column="HelpFile_">YourHelpFileKey</Data>
<
Data Column="HelpNamespace_">YourHelpNamespaceKey</Data>
</
Row>
</
CustomTable>

Saturday, November 03, 2007

Integrating Help2 files into VS 2005 - part 1

For various reasons (curiosity among others) I've been playing with integrating custom API documentation into Visual Studio, this turned out to be rather laborious.

For future reference I thought I'd document the process here.

- Create the code to be documented, use xml comments and turn on the generate xml comments switch in the project settings.

- Install Visual Studio SDK (yes, really ...)

- Install Sandcastle

- Install Sandcastle Help File Builder

- Open SHFB and create a Help2 project and customize appropriately.

- When the project builds successfully, open all the various .Hx? files (except .HxS) and remove the DTD reference, and from the .HxC file also the <CompilerOptions> element including contents. (For further info refer to the helpware site.)

- Now Microsoft wants you to use the Help Collection Integration Wizard, or manually edit merge files with Orca, neither of which is any fun.

- WiX has a WixVSExtension that among other thing has <HelpFile>, <HelpFileRef>, <HelpCollection> and <PlugCollectionInto> elements which sound promising.

- The problem: the WixVSExtension is currently broken, specifically bug 1588180 

- The bug comments include a suggested fix that involves recompiling WiX. Due to dependency issues this seems like a PITA.

- There is however also another workaround ... stay tuned!

Tuesday, February 13, 2007

Extend right-click menu in Explorer in WiX installer

I just had the need to make an installer that created a right-click menu item for Visual Studio solution files (.sln)

The easiest way to accomplish this would have been to use the WiX built in support for registering extensions:

<Extension ContentType="text\plain" Id="sln">
<Verb Id="Visualize" Command="Visualize dependencies"
TargetFile
="DependencyVisualizerExe"
Argument
='"%1"'/>
</Extension>


However, I soon found out that this was a Bad Idea, in the sense that then my software took over as the default handler for .sln files. Not exactly what I wanted...


Turns out that I needed to manually install the registry keys/values in the appropriate place to get it to work:



<Component Id="DependencyVisualizerComponent" Guid="PUT-GUID-HERE">
<File Name="DependencyVisualizer.exe" Id="DependencyVisualizerExe"
Source
="!(wix.SourceDir)DependencyVisualizer.exe"/>
<RegistryKey Action="createAndRemoveOnUninstall" Root="HKCR"
Key
="VisualStudio.Launcher.sln\Shell\Visualize">
<RegistryValue Action="write" Value="Visualize Dependencies" Type="string" />
<RegistryKey Action="createAndRemoveOnUninstall" Key="Command">
<RegistryValue Action="write" Type="string"
Value
="&quot;[#DependencyVisualizerExe]&quot; "%1""/>
</RegistryKey>
</RegistryKey>
</Component>


Oh, and the tool I'm working on is a tool for visualizing inter-project dependencies...

Wednesday, October 18, 2006

List of Wix3 'autodetected' products

Jonathan de Halleux asked for a list of 'autodetected' products in Wix3.

Looking for something to do, I went through the sources for 3.0.2211.0 (src\ext\*\wixlib\*.wxs) for relevant properties.

NetFxExtension:
- NETFRAMEWORK10
- NETFRAMEWORK11
- NETFRAMEWORK20
- NETFRAMEWORK30
- NETFRAMEWORK11SDKDIR
- NETFRAMEWORK20SDKDIR

IisExtension:
- IISMAJORVERSION
- IISMINORVERSION