Need a GUID?

Seems like every piece of XML-code I recently write (mainly for WiX and MOSS these days) needs just about a dozen of GUIDs all over the place – well maybe just a bundle :=) … anyway!

OK, so guidgen.exe is a lot of help, but it’s also kind of a PITA to leave the keyboard, grab the mouse, do the clicking … in this time you could think of a new GUID yourself! So there must be a better way – and there is!

Just create a simple macro returning a new GUID – and you’re all set.

  1. start a new macro-project, maybe rename the default-module to something more appropriate
  2. use DTE.ActiveDocument.Selection.Text = System.Guid.NewGuid().ToString("D").ToUpper() to grab a new GUID
  3. assign the newly created macro a keyboard shortcut (tools\options\environment\keyboard) – ALG+G seems to be pretty intuitive
  4. ready to roll the GUIDs

Leave a Comment.