Let\'s say I generate my WIX XML file with a Product Id of *. Also for each Component GUID I use a *.
This may be somewhat misguided but I did have a lot of files I was importing as components into a new WiX Product.wxs
file. I discovered after I had created all the components with Guid="*"
that when trying to build the installer, WiX reported the following error for each component:
The component 'AjaxControlToolkit.dll' has a key file with path 'TARGETDIR\ajaxcontroltoolkit.dll'. Since this path is not rooted in one of the standard directories (like ProgramFilesFolder), this component does not fit the criteria for having an automatically generated guid.
I used the following PowerShell script to assign a new guid to each component. Be aware that this script will modify the Product.wxs
file directly and a backup of the file should be kept in case something goes wrong:
(Get-Content Product.wxs) |
Foreach-Object { $guid = [guid]::NewGuid().ToString(); $_ -replace 'Guid="\*"',"Guid=""$guid"""} |
Out-File Product.wxs