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

Import Solutions Using Config Error #230

Closed varneyna closed 3 years ago

varneyna commented 3 years ago

Hello,

My goal is to have a build pipeline in Azure DevOps that can export mulitple solutions and then a release that can import those solutions into a different environment. For example, export from a Dev Instance and Import into a QA Instance.

I'm currently using the Power DevOps Tools to export solutions and import solutions in Azure DevOps. I've got a build pipeline that uses the "Exports Solutions Using Config" task as well as copies the config file that is pulled from DevOps. See below: image image image image

Next I've got a release that is supposed to import the solutions using the config file that was copied from the build step and published to the same location as the solutions.

image This is the location of the drop folder that is being used and was published from the build. image image

Everything works up until the importing of the solutions. When I 'Create Release' it runs all the way through where the config file finds two solutions to process. It errors when it tries to import saying the following: image

It looks like it's thinking the config file is inside the solution but for this task I don't think that makes sense because it's supposed to import multiple solutions from the config (that's what I'm interpreting at least). I've put the full error below and I'm hoping someone can point me in the right direction for how to make this work. It's the final step that I need to complete my build/release pipeline. Also, please note where you see this "REMOVED BY DEV" I've removed information specific to our tenant and org.

2020-12-29T18:08:16.7385353Z ##[debug]Evaluating condition for step: 'Import Solutions Using Config' 2020-12-29T18:08:16.7388174Z ##[debug]Evaluating: succeeded() 2020-12-29T18:08:16.7388813Z ##[debug]Evaluating succeeded: 2020-12-29T18:08:16.7390145Z ##[debug]=> True 2020-12-29T18:08:16.7390745Z ##[debug]Result: True 2020-12-29T18:08:16.7391476Z ##[section]Starting: Import Solutions Using Config 2020-12-29T18:08:16.7580799Z ============================================================================== 2020-12-29T18:08:16.7581186Z Task : Import Solutions Using Config 2020-12-29T18:08:16.7581527Z Description : Imports PowerApps/CDS/Dynamics 365 Solutions using a json configuration 2020-12-29T18:08:16.7581823Z Version : 12.0.14 2020-12-29T18:08:16.7582119Z Author : Wael Hamze 2020-12-29T18:08:16.7582612Z Help : This task invokes ImportSolutionRequest 2020-12-29T18:08:16.7583174Z ============================================================================== 2020-12-29T18:08:17.6026792Z ##[debug]VstsTaskSdk 0.10.0 commit 787a46ec0a2df5b4d12c2e801bd3f319975c054c 2020-12-29T18:08:17.7376201Z ##[debug]Entering MSCRMImportSolutionsUsingConfig.ps1 2020-12-29T18:08:17.7731587Z ##[debug]INPUT_CRMCONNECTIONSTRING: '' 2020-12-29T18:08:17.7782004Z ##[debug]INPUT_CONFIGFILEPATH: 'D:\a\r1\a_DevOpsForD365\drop\ReleaseConfigurationFile.json' 2020-12-29T18:08:17.7831664Z ##[debug]INPUT_LOGSDIRECTORY: 'D:\a\r1\a' 2020-12-29T18:08:17.7863868Z ##[debug]INPUT_CRMCONNECTIONTIMEOUT: '240' 2020-12-29T18:08:17.7917561Z ##[debug] Converted to int: 240 2020-12-29T18:08:17.7949987Z ##[debug]crmConnectionString = 2020-12-29T18:08:17.7987492Z ##[debug]configFilePath = D:\a\r1\a_DevOpsForD365\drop\ReleaseConfigurationFile.json 2020-12-29T18:08:17.8048948Z ##[debug]logsDirectory = D:\a\r1\a 2020-12-29T18:08:17.8060937Z ##[debug]crmConnectionTimeout = 240 2020-12-29T18:08:17.8090062Z ##[debug]MSCRM Tools Path: C:/hostedtoolcache/windows\MSCRMBuildTools\12.0.37 2020-12-29T18:08:17.8327354Z ##[debug]Entering ImportSolutionsUsingConfig.ps1 2020-12-29T18:08:17.8366369Z ##[debug]CrmConnectionString = * 2020-12-29T18:08:17.8389101Z ##[debug]LogsDirectory = D:\a\r1\a 2020-12-29T18:08:17.8414253Z ##[debug]ConfigFilePath = D:\a\r1\a_DevOpsForD365\drop\ReleaseConfigurationFile.json 2020-12-29T18:08:17.8480226Z ##[debug]Timeout = 240 2020-12-29T18:08:17.8587280Z ##[debug]Script Path: C:\hostedtoolcache\windows\MSCRMBuildTools\12.0.37\xRMCIFramework\9.0.0 2020-12-29T18:08:17.8630730Z ##[debug]Importing CIToolkit: C:\hostedtoolcache\windows\MSCRMBuildTools\12.0.37\xRMCIFramework\9.0.0\Xrm.Framework.CI.PowerShell.Cmdlets.dll 2020-12-29T18:08:17.8661779Z ##[debug]Loading module from path 'C:\hostedtoolcache\windows\MSCRMBuildTools\12.0.37\xRMCIFramework\9.0.0\Xrm.Framework.CI.PowerShell.Cmdlets.dll'. 2020-12-29T18:08:17.8768334Z ##[debug]Importing cmdlet 'Add-XrmEntity'. 2020-12-29T18:08:17.8794252Z ##[debug]Importing cmdlet 'Add-XrmLanguagePack'. 2020-12-29T18:08:17.8869762Z ##[debug]Importing cmdlet 'Add-XrmSolution'. 2020-12-29T18:08:17.8896593Z ##[debug]Importing cmdlet 'Add-XrmSolutionPatch'. 2020-12-29T18:08:17.8922942Z ##[debug]Importing cmdlet 'Compress-XrmCMData'. 2020-12-29T18:08:17.8948647Z ##[debug]Importing cmdlet 'Expand-XrmCMData'. 2020-12-29T18:08:17.8977043Z ##[debug]Importing cmdlet 'Expand-XrmSolution'. 2020-12-29T18:08:17.9022341Z ##[debug]Importing cmdlet 'Compress-XrmSolution'. 2020-12-29T18:08:17.9043944Z ##[debug]Importing cmdlet 'Get-XrmConnections'. 2020-12-29T18:08:17.9070343Z ##[debug]Importing cmdlet 'Set-XrmEnvironmentVariableValue'. 2020-12-29T18:08:17.9098699Z ##[debug]Importing cmdlet 'Get-XrmEnvironmentVariableValue'. 2020-12-29T18:08:17.9126265Z ##[debug]Importing cmdlet 'Get-XrmSolutionMissingDependencies'. 2020-12-29T18:08:18.0282117Z ##[debug]Importing cmdlet 'Get-XrmSolutionMissingComponents'. 2020-12-29T18:08:18.0291298Z ##[debug]Importing cmdlet 'Publish-XrmTheme'. 2020-12-29T18:08:18.0344898Z ##[debug]Importing cmdlet 'Remove-XrmConnection'. 2020-12-29T18:08:18.0375013Z ##[debug]Importing cmdlet 'Get-XrmConnection'. 2020-12-29T18:08:18.0410547Z ##[debug]Importing cmdlet 'Set-XrmConnection'. 2020-12-29T18:08:18.0442593Z ##[debug]Importing cmdlet 'Copy-XrmSolutionComponents'. 2020-12-29T18:08:18.0471128Z ##[debug]Importing cmdlet 'Export-XrmAccessTeamTemplates'. 2020-12-29T18:08:18.0499744Z ##[debug]Importing cmdlet 'Export-XrmSolutions'. 2020-12-29T18:08:18.0527559Z ##[debug]Importing cmdlet 'Export-XrmSolution'. 2020-12-29T18:08:18.0553114Z ##[debug]Importing cmdlet 'Get-XrmEntities'. 2020-12-29T18:08:18.0591879Z ##[debug]Importing cmdlet 'Get-XrmEntity'. 2020-12-29T18:08:18.0599440Z ##[debug]Importing cmdlet 'Get-XrmLanguagePacks'. 2020-12-29T18:08:18.0627101Z ##[debug]Importing cmdlet 'Get-XrmPluginRegistrationClass'. 2020-12-29T18:08:18.0654626Z ##[debug]Importing cmdlet 'Get-XrmPluginRegistrationFromAssembly'. 2020-12-29T18:08:18.0683812Z ##[debug]Importing cmdlet 'Get-XrmServiceEndpointRegistration'. 2020-12-29T18:08:18.0708062Z ##[debug]Importing cmdlet 'Get-XrmPluginRegistration'. 2020-12-29T18:08:18.0736629Z ##[debug]Importing cmdlet 'Get-XrmSolutionPatches'. 2020-12-29T18:08:18.0765372Z ##[debug]Importing cmdlet 'Get-XrmSolution'. 2020-12-29T18:08:18.0802871Z ##[debug]Importing cmdlet 'Get-XrmSolutionImportLog'. 2020-12-29T18:08:18.0824431Z ##[debug]Importing cmdlet 'Get-XrmSolutionInfoFromFolder'. 2020-12-29T18:08:18.0848810Z ##[debug]Importing cmdlet 'Get-XrmSolutionInfoFromZip'. 2020-12-29T18:08:18.0912904Z ##[debug]Importing cmdlet 'Import-XrmAccessTeamTemplates'. 2020-12-29T18:08:18.0946850Z ##[debug]Importing cmdlet 'Import-XrmSolutions'. 2020-12-29T18:08:18.0977786Z ##[debug]Importing cmdlet 'Merge-XrmSolution'. 2020-12-29T18:08:18.1001746Z ##[debug]Importing cmdlet 'Import-XrmSolution'. 2020-12-29T18:08:18.1024976Z ##[debug]Importing cmdlet 'Merge-XrmSolutionPatches'. 2020-12-29T18:08:18.1049661Z ##[debug]Importing cmdlet 'New-XrmBulkDeleteJob'. 2020-12-29T18:08:18.1079452Z ##[debug]Importing cmdlet 'New-XrmEntity'. 2020-12-29T18:08:18.1105364Z ##[debug]Importing cmdlet 'Publish-XrmCustomizations'. 2020-12-29T18:08:18.1132916Z ##[debug]Importing cmdlet 'Publish-XrmDuplicateRule'. 2020-12-29T18:08:18.1160969Z ##[debug]Importing cmdlet 'Remove-XrmEntityAttribute'. 2020-12-29T18:08:18.1184250Z ##[debug]Importing cmdlet 'Remove-XrmEntity'. 2020-12-29T18:08:18.1209004Z ##[debug]Importing cmdlet 'Remove-XrmOption'. 2020-12-29T18:08:18.1235109Z ##[debug]Importing cmdlet 'Remove-XrmWorkflow'. 2020-12-29T18:08:18.1259825Z ##[debug]Importing cmdlet 'Remove-XrmRecord'. 2020-12-29T18:08:18.1286551Z ##[debug]Importing cmdlet 'Set-XrmDashboardRole'. 2020-12-29T18:08:18.1311966Z ##[debug]Importing cmdlet 'Set-XrmEntityState'. 2020-12-29T18:08:18.1336360Z ##[debug]Importing cmdlet 'Set-XrmWorkflowState'. 2020-12-29T18:08:18.1360302Z ##[debug]Importing cmdlet 'Compress-XrmSolutions'. 2020-12-29T18:08:18.1393791Z ##[debug]Importing cmdlet 'Show-XrmLogging'. 2020-12-29T18:08:18.1419253Z ##[debug]Importing cmdlet 'Remove-XrmSolutionComponents'. 2020-12-29T18:08:18.1443311Z ##[debug]Importing cmdlet 'Select-WhoAmI'. 2020-12-29T18:08:18.1469945Z ##[debug]Importing cmdlet 'Remove-XrmPluginAssembly'. 2020-12-29T18:08:18.1494571Z ##[debug]Importing cmdlet 'Set-XrmServiceEndpointRegistration'. 2020-12-29T18:08:18.1520293Z ##[debug]Importing cmdlet 'Set-XrmWebResourcesFromFolder'. 2020-12-29T18:08:18.1545545Z ##[debug]Importing cmdlet 'Set-XrmWebResource'. 2020-12-29T18:08:18.1569695Z ##[debug]Importing cmdlet 'Set-XrmPluginAssembly'. 2020-12-29T18:08:18.1593984Z ##[debug]Importing cmdlet 'Set-XrmEntity'. 2020-12-29T18:08:18.1619023Z ##[debug]Importing cmdlet 'Set-XrmSolutionVersion'. 2020-12-29T18:08:18.1642747Z ##[debug]Importing cmdlet 'Set-XrmSolutionVersionInFolder'. 2020-12-29T18:08:18.1668805Z ##[debug]Importing cmdlet 'Split-XrmPluginAssembly'. 2020-12-29T18:08:18.1695198Z ##[debug]Importing cmdlet 'Set-XrmPluginRegistration'. 2020-12-29T18:08:18.1721383Z ##[debug]Imported CIToolkit 2020-12-29T18:08:18.1746178Z ##[debug]Importing Solutions 2020-12-29T18:08:18.1806892Z ##[debug]PS Version: 5.1.17763.1490 2020-12-29T18:08:18.1895364Z ##[debug]Microsoft.Xrm.Sdk.dll - Version : 9.0.45.2282 2020-12-29T18:08:18.1920549Z ##[debug]Microsoft.Xrm.Tooling.Connector.dll - Version : 4.0.0.60 2020-12-29T18:08:18.1949988Z ##[debug]Current Security Protocol: Tls, Tls11, Tls12 2020-12-29T18:08:18.1983802Z ##[debug]Modified Security Protocol: Tls, Tls11, Tls12 2020-12-29T18:08:18.2116842Z ##[debug]Connecting to CRM [attempt 1] 2020-12-29T18:08:19.0966140Z ##[debug]Connected to Org Url: REMOVED BY DEV/2011/Organization.svc/web?SDKClientVersion=9.0.45.2282 2020-12-29T18:08:19.1038869Z ##[debug]Connected to Org Id: REMOVED BY DEV 2020-12-29T18:08:19.1072069Z ##[debug]Connected to Environment Id: REMOVED BY DEV 2020-12-29T18:08:19.1105542Z ##[debug]Connected to Org Friendly Name: REMOVED BY DEV 2020-12-29T18:08:19.1130582Z ##[debug]Connected to Org Unique Name: REMOVED BY DEV 2020-12-29T18:08:19.1158403Z ##[debug]Connected to Tenant Id: REMOVED BY DEV 2020-12-29T18:08:19.1182711Z ##[debug]Connected to Org Version: 9.1.0.25851 2020-12-29T18:08:19.1245998Z ##[debug]SdkVersionProperty: 9.0.45.2282 2020-12-29T18:08:19.1278079Z ##[debug]Session Tracking Id: 0264368f-c135-4d44-9e74-753eb37c6518 2020-12-29T18:08:19.2077352Z ##[debug]Connection to CRM Established using OrganizationWebProxyClient 2020-12-29T18:08:19.2118102Z ##[debug]Entering XrmImportSolutions 2020-12-29T18:08:19.2147371Z ##[debug]Creating Polling Service 2020-12-29T18:08:19.2179176Z ##[debug]Microsoft.Xrm.Sdk.dll - Version : 9.0.45.2282 2020-12-29T18:08:19.2201250Z ##[debug]Microsoft.Xrm.Tooling.Connector.dll - Version : 4.0.0.60 2020-12-29T18:08:19.2229328Z ##[debug]Current Security Protocol: Tls, Tls11, Tls12 2020-12-29T18:08:19.2253874Z ##[debug]Modified Security Protocol: Tls, Tls11, Tls12 2020-12-29T18:08:19.2299939Z ##[debug]Connecting to CRM [attempt 1] 2020-12-29T18:08:19.5208742Z ##[debug]Connected to Org Url: REMOVED BY DEV/XRMServices/2011/Organization.svc/web?SDKClientVersion=9.0.45.2282 2020-12-29T18:08:19.5236963Z ##[debug]Connected to Org Id: REMOVED BY DEV 2020-12-29T18:08:19.5269435Z ##[debug]Connected to Environment Id: REMOVED BY DEV 2020-12-29T18:08:19.5294504Z ##[debug]Connected to Org Friendly Name: REMOVED BY DEV 2020-12-29T18:08:19.5322201Z ##[debug]Connected to Org Unique Name: REMOVED BY DEV 2020-12-29T18:08:19.5350352Z ##[debug]Connected to Tenant Id:REMOVED BY DEV** 2020-12-29T18:08:19.5444108Z ##[debug]Connected to Org Version: 9.1.0.25851 2020-12-29T18:08:19.5518804Z ##[debug]SdkVersionProperty: 9.0.45.2282 2020-12-29T18:08:19.5544954Z ##[debug]Session Tracking Id: 26a48505-e522-44fa-84ec-2c24e945d917 2020-12-29T18:08:19.5617088Z ##[debug]Connection to CRM Established using OrganizationWebProxyClient 2020-12-29T18:08:19.5644299Z ##[debug]Finished Creating Polling Service 2020-12-29T18:08:19.5674468Z ##[debug]Starting to proccess solutions 2020-12-29T18:08:19.6006931Z ##[debug]Parsing import json file D:\a\r1\a_DevOpsForD365\drop\ReleaseConfigurationFile.json 2020-12-29T18:08:19.9122788Z ##[debug]Finished parsing import json file D:\a\r1\a_DevOpsForD365\drop\ReleaseConfigurationFile.json 2020-12-29T18:08:19.9150722Z ##[debug]2 solution for import found 2020-12-29T18:08:19.9246458Z Importing Solution: D:\a\r1\a_DevOpsForD365\drop\ 2020-12-29T18:08:19.9328309Z ##[debug]ImportJobId a0711d2d-f429-4248-8afe-a6224716ec4a 2020-12-29T18:08:19.9359078Z ##[debug]AsyncWaitTimeout: 900 2020-12-29T18:08:19.9425165Z ##[debug]SleepInterval: 15 2020-12-29T18:08:19.9590452Z Exception Caught: Solution File does not exist: D:\a\r1\a_DevOpsForD365\drop\ 2020-12-29T18:08:19.9617575Z ##[debug]Uploading import log files 2020-12-29T18:08:19.9661186Z ##[debug]Completed uploading import log files 2020-12-29T18:08:19.9784823Z ##[debug]Caught exception from task script. 2020-12-29T18:08:19.9828401Z ##[debug]Error record: 2020-12-29T18:08:20.0727163Z ##[debug]Import-XrmSolutions : Solution File does not exist: D:\a\r1\a_DevOpsForD365\drop\ 2020-12-29T18:08:20.0750559Z ##[debug]At C:\hostedtoolcache\windows\MSCRMBuildTools\12.0.37\xRMCIFramework\9.0.0\ImportSolutionsUsingConfig.ps1:37 char:18 2020-12-29T18:08:20.0771682Z ##[debug]+ ... rtResults = Import-XrmSolutions -ConnectionString "$CrmConnectionStri ... 2020-12-29T18:08:20.0794678Z ##[debug]+ ~~~~~~~~~~~~~ 2020-12-29T18:08:20.0816239Z ##[debug] + CategoryInfo : WriteError: (:) [Import-XrmSolutions], Exception 2020-12-29T18:08:20.0843079Z ##[debug] + FullyQualifiedErrorId : XrmCIFramework,Xrm.Framework.CI.PowerShell.Cmdlets.ImportXrmSolutionsCommand 2020-12-29T18:08:20.0862404Z ##[debug] 2020-12-29T18:08:20.0898340Z ##[debug]Script stack trace: 2020-12-29T18:08:20.0964335Z ##[debug]at , C:\hostedtoolcache\windows\MSCRMBuildTools\12.0.37\xRMCIFramework\9.0.0\ImportSolutionsUsingConfig.ps1: line 37 2020-12-29T18:08:20.0984695Z ##[debug]at , D:\a_tasks\MSCRMImportSolutionsUsingConfig_ee3c3fab-fda0-4f27-8535-eb0b7771c5be\12.0.14\MSCRMImportSolutionsUsingConfig.ps1: line 38 2020-12-29T18:08:20.1089175Z ##[debug]at , : line 1 2020-12-29T18:08:20.1113133Z ##[debug]at , : line 22 2020-12-29T18:08:20.1140722Z ##[debug]at , : line 18 2020-12-29T18:08:20.1161331Z ##[debug]at , : line 1 2020-12-29T18:08:20.1218921Z ##[debug]Exception: 2020-12-29T18:08:20.1269264Z ##[debug]System.Exception: Solution File does not exist: D:\a\r1\a_DevOpsForD365\drop\ 2020-12-29T18:08:20.1564007Z ##[error]Solution File does not exist: D:\a\r1\a_DevOpsForD365\drop\ 2020-12-29T18:08:20.1581374Z ##[debug]Processed: ##vso[task.logissue type=error]Solution File does not exist: D:\a\r1\a_DevOpsForD365\drop\ 2020-12-29T18:08:20.1583367Z ##[debug]Processed: ##vso[task.complete result=Failed] 2020-12-29T18:08:20.1964648Z ##[section]Finishing: Import Solutions Using Config

Thank you!!

varneyna commented 3 years ago

This was a user error, I was trying to use the same config file from the Export when doing the Import and they are different. Once I used the proper file I was able to make the build/release pipeline work for multiple solutions. Thank you so much Wael for providing these tools!!