Skip to content

Commit

Permalink
Removed check that verified that the Import Progress of the solution …
Browse files Browse the repository at this point in the history
…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.
  • Loading branch information
ikurtev committed Feb 10, 2017
1 parent 6b15b9e commit 2cd04d3
Showing 1 changed file with 26 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down

0 comments on commit 2cd04d3

Please sign in to comment.