The samples in the WiX tutorial contain many Id='YOURGUID-86C7-4D14-AEC0-86416A69ABDE' placeholders that need to be replaced with your own GUIDs before they can be used. It’s tedious to do this manually a dozen times for each file, so I automated it in Emacs with the lisp below:
(defun replace-guids () "Replaces GUID placeholders from WiX sample projects" (interactive) (goto-char 1) (while (search-forward-regexp "YOURGUID-[0-9A-Z\-]+" nil t) (replace-match (replace-regexp-in-string "\n$" "" (shell-command-to-string "uuidgen")) t nil)))
You can assign it to a key sequence with global-set-key, like this:
(global-set-key (kbd "C-c C-u") 'replace-guids)
This assumes you have Cygwin’s
uuidgen in your path.
It does search-forward-regexp repeatedly instead of a single replace-regexp because replacement string would get evaluated once for the entire command. We need to create a new GUID for every one of the replacements.