PowerShell for Wix Components

PowerShell

The following snippet is useful for generating a list of components with unique Guids. Run it from the directory that contains the components:

$files = Get-ChildItem

$g = [System.Guid]

foreach ($a in $files) { Write-Output ("<Component Id='{0}' Guid='{1}'>\`n\`t<File Source='\`$(var.)\\{0}' KeyPath='yes'/>\`n</Component>" -f $a.Name, $g::NewGuid() ) }