forked from DaxStudio/DaxStudio
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup-build-env.ps1
68 lines (45 loc) · 1.52 KB
/
setup-build-env.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
56
57
58
59
60
61
62
63
64
65
66
67
## =====================================================
##
## DAX Studio - build environment setup script.
##
## this script copies a couple of dlls into the
## a lib folder so that DaxStudio will build.
## =====================================================
cls
## Declare the required dll's and search folders
$requiredDlls = @("Microsoft.Excel.AdomdClient.dll"
, "Microsoft.Excel.Amo.dll"
, "Microsoft.AnalysisServices.AdomdClient.dll")
$searchFolders = @("${Env:ProgramFiles(x86)}\Common Files\Microsoft Shared\Office15\DataModel\"
, "$Env:ProgramFiles\Microsoft Office 15\root\vfs\ProgramFilesCommonX86\Microsoft Shared\OFFICE15\DataModel\"
, "$Env:ProgramFiles\Microsoft.NET\ADOMD.NET\110\"
, "$Env:ProgramFiles\Microsoft.NET\ADOMD.NET\120\"
)
## 1. Create lib subfolder
$ScriptRoot = Split-Path -Parent -Path $MyInvocation.MyCommand.Definition
$libPath = "$ScriptRoot\lib"
if (-not (Test-Path $libPath))
{
mkdir $libPath | Out-Null
}
## 2. Try to copy the dlls by searching for it in all the declared folders
$searchFolders |% {
$folder = $_
$requiredDlls |% {
$dllName = $_
$dllPath = Join-Path $folder $dllName
if (Test-Path $dllPath)
{
$newDllPath = Join-Path $libPath $dllName
Copy-Item $dllPath $newDllPath -Verbose
}
}
}
## 3. Confirms if all the dlls had been copied
$dllsOnLibFolder = gci -Path $libPath -Filter "*.dll" | select -ExpandProperty Name
$requiredDlls |% {
if (-not ($dllsOnLibFolder -contains $_))
{
Write-Warning "Cannot find dependency: $($_)"
}
}