Reputation: 27
We have created a webresource for theme update for CRM portal using XML
<AppHeaderColors background="#45B2FF" foreground="#FFFFFF" backgroundHover="#165A31" foregroundHover="#FFFFFF" backgroundPressed="#0F1C12" foregroundPressed="#FFFFFF" backgroundSelected="#153D23" foregroundSelected="#FFFFFF" />
We planned to have different values for each env we use like test uat and prod. so we planned to edit the managed zip solution we export and unzip zip file edit the component and zip the file and deploy.
We are facing issue when we zip the file using the PowerShell zip cmdlet when we try to import the solution it throws the error like some dll path are missing for our plugins but the plugins are available inside the solution.
If we do it manually like select the required file-->right click-->send to--> compressed there is no issue in the import of the solution
This is used to update the theme for the powerapps in webresources
#>
param (
[Parameter(Mandatory = $true, HelpMessage = "Path of the webresource solution.")]
[string]
$solutionPath,
[Parameter(Mandatory = $true, HelpMessage = "Path for extracting webresource solution .")]
[string]
$solutionExtractPath,
[Parameter(Mandatory = $true, HelpMessage = "Webresource solution name.")]
[string]
$solutionName,
[Parameter(Mandatory = $true, HelpMessage = "Name of the webresource file.")]
[string]
$webresourceFileName,
[Parameter(Mandatory = $true, HelpMessage = "Attributes Name and value to Change Eg: 'key1=value,key2=value2'")]
[string]
$AttributeNameValue,
[parameter()]
[hashtable]
$hashtable
)
$hashtable = $AttributeNameValue -replace ",", "`n" | ConvertFrom-StringData
Expand-Archive -Path $solutionPath\$solutionName -DestinationPath $solutionExtractPath -Force
$XMLfilePath = Get-ChildItem -Path $solutionExtractPath\WebResources -Recurse -Filter $webresourceFileName*
[XML]$CRMSolutions = Get-Content $XMLfilePath.FullName
foreach ($attribute in $hashtable.GetEnumerator()) {
$AttributeName = $attribute.key
$CRMSolutions.AppHeaderColors.$AttributeName = $attribute.value
}
$CRMSolutions.save($XMLfilePath.FullName)
Remove-Item -Path $solutionPath\$solutionName -Force -Recurse
Compress-Archive -Path $solutionExtractPath\* -DestinationPath $solutionPath\$solutionName -Update
Remove-Item -Path $solutionExtractPath -Force -Recurse
Upvotes: 0
Views: 79
Reputation: 2596
I would recommend using official pac solution
tool to pack and unpack solutions.
Upvotes: 0