Set TimeOut when importing large CRM Dynamics customisation file

Recently while trying to deploy a CRM package into system test  environment using the import-crmpackage command via PowerShell, time-out was occurring despite doubling the RAM memory as well as removing a lot of checkpoints from the machine.

On the DEV environment, the deployment was taking around 20 mins. The DEV machine has more resources allocated explaining why the time-out was not spotted.

To resolve the timeout issue, the lengthy instructions from Microsoft Knowledge Base Article can be followed. A simpler solution would be to set the timeout property during import.

From the Import-CrmPackage documentation the -timeout property is of type string and meant for internal purpose only. The format of data the -timeout property is not evident. We tried passing “3600” which would be 1 hour if the property was expecting seconds, however the import-crmpackage failed because of invalid data.

Import-CrmPackage -CrmConnection $CRMConn -PackageDirectory "$($filePath)" -PackageName CRMPackageDeploymentTest.dll -Verbose -Timeout "3600"; Import-

Using a .Net Reflector tool, we managed to find out the format the timeout property needs to be passed is a timespan object of format “g”. By default the timeout is set to 30 mins.

Import-CrmPackage -CrmConnection $CRMConn -PackageDirectory "$($filePath)" -PackageName CRMPackageDeploymentTest.dll -Verbose -Timeout "1:00:00";

The deployment process took 34 mins to finish and timeout error was not thrown.