WIX Autogenerate GUID *?

前端 未结 7 1550
无人及你
无人及你 2020-12-05 09:44

Let\'s say I generate my WIX XML file with a Product Id of *. Also for each Component GUID I use a *.

  

        
7条回答
  •  攒了一身酷
    2020-12-05 10:27

    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
    

提交回复
热议问题