From 2cd04d3d102ee8f9159e43bf1b76efc5146e67ef Mon Sep 17 00:00:00 2001 From: ikurtev Date: Fri, 10 Feb 2017 14:58:40 -0500 Subject: [PATCH] Removed check that verified that the Import Progress of the solution is 100% as solutions frequently import successfully with Import Progress less than 100%. Instead, added check that looks for any solution components in the Import Log file that have a result equal to "failure" which is a more reliable indicator if anything went wrong with the solution import. --- .../ImportSolution.ps1 | 30 ++++++++++++++++--- 1 file changed, 26 insertions(+), 4 deletions(-) diff --git a/CRM365/Xrm.Framework.CI/Xrm.Framework.CI.PowerShell.Scripts/ImportSolution.ps1 b/CRM365/Xrm.Framework.CI/Xrm.Framework.CI.PowerShell.Scripts/ImportSolution.ps1 index edb8178a..b69ff129 100644 --- a/CRM365/Xrm.Framework.CI/Xrm.Framework.CI.PowerShell.Scripts/ImportSolution.ps1 +++ b/CRM365/Xrm.Framework.CI/Xrm.Framework.CI.PowerShell.Scripts/ImportSolution.ps1 @@ -91,16 +91,38 @@ if ($override -or ($solution -eq $null) -or ($solution.Version -ne $solutionInfo Write-Verbose "Import Error Text: $importErrorText" Write-Verbose $importJob.Data - if (($importResult -ne "success") -or ($importProgress -ne 100)) + if ($importResult -ne "success") { throw "Import Failed" } - $solution = Get-XrmSolution -ConnectionString $CrmConnectionString -UniqueSolutionName $solutionInfo.UniqueName + #parse the importexportxml and look for result notes with result="failure" + $importFailed = $false + $importjobXml = [xml]$importJob.Data + $failureNodes = $importjobXml.SelectNodes("//*[@result='failure']") - if ($solution.Version -ne $solutionInfo.Version) + foreach ($failureNode in $failureNodes){ + $componentName = $failureNode.ParentNode.Attributes['name'].Value + $errorText = $failureNode.Attributes['errortext'].Value + Write-Host "Component Import Failure: '$componentName' failed with error: '$errorText'" + $importFailed = $true + } + + if ($importFailed -eq $true) + { + throw "The Solution Import failed because one or more components with a result of 'failure' were found. For detals, check the Diagnostics for this build or the solution import log file in the logs subfolder of the Drop folder." + } + else + { + Write-Host "The import result of all components is 'success'." + } + #end parse the importexportxml and look for result notes with result="failure" + + $solution = Get-XrmSolution -ConnectionString $CrmConnectionString -UniqueSolutionName $solutionInfo.UniqueName + + if ($solution.Version -ne $solutionInfo.Version) { - throw "Import Failed" + throw "Import Failed. Check the solution import log file in the logs subfolder of the Drop folder." } else {