forked from rnwood/DataVerseALM-legacy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathimport.ps1
55 lines (42 loc) · 1.18 KB
/
import.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
[CmdletBinding()]
param([Switch] $dataonly, [Switch] $nodata, [string] $url)
$ErrorActionPreference="Stop"
$VerbosePreference="Continue"
try {
$root = (split-path $MyInvocation.MyCommand.Source)
write-verbose "Root: $root"
. $root\common.ps1
if (-not $url) {
$url = getConfigValue DEVURL
}
$connection = getCrmConnection $url
if (-not $dataonly) {
foreach($dependency in $dependencies) {
$dependency = (resolve-path $dependency).Path
importCrmSolution -solutionfile $dependency -connection $connection -managed
}
try {
$tempfile = $null
$managed=$false
if (test-path $root\$solutionname.zip) {
$zipfile = "$root\$solutionname.zip"
$managed=$true
} else {
$zipfile = $tempfile = [IO.Path]::GetTempFileName()
packCrmSolution -folder $root\solution -zipfile $zipfile
}
importCrmSolution -solutionfile $zipfile -connection $connection -managed:$managed
} finally {
if ($tempfile) {
remove-item -Force $zipfile
}
}
publishCrmCustomizations -connection $connection
}
if (-not $nodata) {
importCrmData -connection $connection -datadir $root\data
}
} catch {
$_.ScriptStackTrace | Write-Host
throw
}