Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Package Deployer - Asynchronous Solution Import #251

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@ param(
[string]$PackageDeploymentPath,
[string]$ToolingConnectorModulePath,
[string]$Timeout = '00:30:00', #optional timeout for Import-CrmPackage, default to 1 hour and 20 min. See https://technet.microsoft.com/en-us/library/dn756301.aspx
[int]$CrmConnectionTimeout = 2,
[int]$CrmConnectionTimeout = 2,
[string]$RuntimePackageSettings,
[string]$UnpackFilesDirectory
[string]$UnpackFilesDirectory,
[bool]$ImportAsync = $false #Import solution in Async Mode, recommended
)

$ErrorActionPreference = "Stop"
Expand All @@ -30,6 +31,7 @@ Write-Verbose "Timeout = $Timeout"
Write-Verbose "CrmConnectionTimeout = $CrmConnectionTimeout"
Write-Verbose "RuntimePackageSettings = $RuntimePackageSettings"
Write-Verbose "UnpackFilesDirectory = $UnpackFilesDirectory"
Write-Verbose "ImportAsync = $ImportAsync"

#Script Location
$scriptPath = split-path -parent $MyInvocation.MyCommand.Definition
Expand All @@ -53,11 +55,11 @@ if ($PackageDeploymentPath)
$crmToolingDeployment = $PackageDeploymentPath + "\Microsoft.Xrm.Tooling.PackageDeployment.Powershell.dll"
}

Write-Verbose "Importing: $crmToolingConnector"
Write-Verbose "Importing: $crmToolingConnector"
Import-Module $crmToolingConnector
Write-Verbose "Imported: $crmToolingConnector"

Write-Verbose "Importing: $crmToolingDeployment"
Write-Verbose "Importing: $crmToolingDeployment"
Import-Module $crmToolingDeployment
Write-Verbose "Imported: $crmToolingDeployment"

Expand Down Expand Up @@ -94,6 +96,11 @@ if ($RuntimePackageSettings)
$PackageParams.RuntimePackageSettings = $RuntimePackageSettings
}

if ($ImportAsync)
{
$PackageParams.EnabledAsyncForSolutionImport = $true
}

Import-CrmPackage @PackageParams -Verbose

Write-Verbose 'Leaving DeployPackage.ps1'
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ $pdTimeout = Get-VstsInput -Name pdTimeout -Require
$crmConnectionTimeout = Get-VstsInput -Name crmConnectionTimeout -Require -AsInt
$unpackFilesDirectory = Get-VstsInput -Name unpackFilesDirectory
$runtimePackageSettings = Get-VstsInput -Name runtimePackageSettings
$useAsyncMode = Get-VstsInput -Name useAsyncMode -Require -AsBool

#TFS Release Parameters
$artifactsFolder = $env:AGENT_RELEASEDIRECTORY
Expand Down Expand Up @@ -64,7 +65,7 @@ New-Item $tempFolder -ItemType directory | Out-Null

try
{
& "$mscrmToolsPath\xRMCIFramework\9.0.0\DeployPackage.ps1" -CrmConnectionString $crmConnectionString -PackageName $packageName -PackageDirectory $packageDirectory -LogsDirectory $tempFolder -toolingConnectorModulePath $CrmConnectorPath -PackageDeploymentPath $PackageDeploymentPath -Timeout $pdTimeout -crmConnectionTimeout $crmConnectionTimeout -unpackFilesDirectory $unpackFilesDirectory -runtimePackageSettings $runtimePackageSettings
& "$mscrmToolsPath\xRMCIFramework\9.0.0\DeployPackage.ps1" -CrmConnectionString $crmConnectionString -PackageName $packageName -PackageDirectory $packageDirectory -LogsDirectory $tempFolder -toolingConnectorModulePath $CrmConnectorPath -PackageDeploymentPath $PackageDeploymentPath -Timeout $pdTimeout -crmConnectionTimeout $crmConnectionTimeout -unpackFilesDirectory $unpackFilesDirectory -runtimePackageSettings $runtimePackageSettings -ImportAsync $useAsyncMode
}
finally
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,14 @@
"defaultValue": "",
"required": false,
"helpMarkDown": "Use to specifiy additional runtime parameters such as LCID=1033"
},
{
"name": "useAsyncMode",
"type": "boolean",
"label": "Use Async Mode",
"defaultValue": "false",
"required": false,
"helpMarkDown": "If set to true will perform operation in asynchronous mode using ExecuteAsyncRequest"
}
],
"execution": {
Expand Down