WaelHamze / dyn365-ce-vsts-tasks

VSTS Extension for Dynamics 365 Customer Engagement
https://marketplace.visualstudio.com/items?itemName=WaelHamze.xrm-ci-framework-build-tasks
GNU General Public License v3.0
115 stars 54 forks source link

Solution upgrade Failed. Error: Solution still exists after upgrade #278

Open fireaimready opened 1 year ago

fireaimready commented 1 year ago

Consistently getting this error with the following yml configuration, have not been able to find a configuration which works:

             `   - task: MSCRMPackSolution@12
                   displayName: 'Pack ${{ solution }}'
                   inputs:
                     unpackedFilesFolder: '$(Build.SourcesDirectory)\D365_Managed_Solutions\${{ solution }}'
                     packageType: 'Managed'
                     outputPath: '$(Build.ArtifactStagingDirectory)'

                 - task: MSCRMImportSolution@12
                   inputs:
                     crmConnectionString: '$(ConnectionString)'
                     solutionFile: '$(Build.ArtifactStagingDirectory)\${{ solution }}_managed.zip'
                     holdingSolution: true
                     useAsyncMode: false

                 - task: MSCRMApplySolution@12
                   inputs:
                     crmConnectionString: '$(ConnectionString)'
                     solutionName: '${{ solution }}'
                     crmConnectionTimeout: '453453' `

The log file: Solution Upgrade Starting. Async Job Id:

[error]Solution upgrade Failed. Error: Solution still exists after upgrade: CRMSolution_Upgrade

Finishing: MSCRMApplySolution4

Error Code in CRM: 80071151

EDIT: Should have mentioned the Uninstall/Upgrade job in the environment itself succeeds. Somehow the pipeline task is getting a notification for a failure and shutting the pipeline down. If I wait for the Uninstall/Upgrade job to complete (it always succeeds), then I can restart the pipeline to continue.

mattp65 commented 1 year ago

The Upgrade solution still existing after an Apply typically means there is a dependency issue related to something that was removed from the solution. Those items aren't deleted until the 'Apply' runs and that is when the issue is detected. There should be an error elsewhere in the log. You can also try manually applying the changes n the target environment to see what error is returned.

fireaimready commented 1 year ago

Appreciate your comment, I should have specified that the actual apply task in the environment succeeds, its just the pipeline task somehow is receiving a failure and interrupting the pipeline. I just have to wait for the Uninstall/Upgrade subroutine to complete before restarting my pipeline to continue where it left off in my solution list.

I should also mention that I modified my pipeline task to deploy via MS power platform tools (non Wael) via async and the solution will successfully deploy and the pipeline will succeed.

mattp65 commented 1 year ago

Try bumping your timeout. Odds are you are exceeding that. The tasks take longer then I would like to see in many areas and the Apply tends to run longer then the Import. The underlying mechanism they provide for these calls is not as robust as it could be and the level of feedback provided to the calling routine is limited.

WaelHamze commented 1 year ago

@fireaimready I presume this is working now?

@mattp65 thanks for responding