[CmdletBinding()]
Param(
[Parameter(Mandatory = $True, Position = 1)]
[string]$fileListName,
[Parameter(Mandatory = $True, Position = 2)]
[string]$wxsFilePath,
[Parameter(Mandatory = $True, Position = 3)]
[string]$regroot
)
$wxsFile = Get-Content $wxsFilePath;
$wxsFile | ForEach-Object {
if ($_ -match "(") {
[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseDeclaredVarsMoreThanAssignments', 'fileList',
Justification = 'variable is used in another scope')]
$fileList = $matches[2] -split ';'
return
}
}
$componentId = "$($fileListName)_Component"
$componentDefs = "`r`n"
$componentDefs +=
@"
`r`n
"@
foreach ($file in $fileList) {
$fileTmp = $file -replace "-", "_"
$componentDefs +=
@"
`r`n
"@
}
$componentDefs +=
@"
`r`n
"@
$wxsFile = $wxsFile -replace "\s+()", $componentDefs
$componentRef =
@"
"@
$wxsFile = $wxsFile -replace "\s+()", "$componentRef`r`n "
Set-Content -Path $wxsFilePath -Value $wxsFile