-
Notifications
You must be signed in to change notification settings - Fork 3.1k
/
init.ps1
37 lines (32 loc) · 1.09 KB
/
init.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
param($installPath, $toolsPath, $package, $project)
if ($PSVersionTable.PSVersion.Major -lt 3)
{
# This section needs to support PS2 syntax
# Use $toolsPath because PS2 does not support $PSScriptRoot
$env:PSModulePath = $env:PSModulePath + ';$toolsPath'
# Import a "dummy" module that contains matching functions that throw on PS2
Import-Module (Join-Path $toolsPath 'EntityFrameworkCore.PowerShell2.psd1') -DisableNameChecking
throw "PowerShell version $($PSVersionTable.PSVersion) is not supported. Please upgrade PowerShell to 3.0 or " +
'greater and restart Visual Studio.'
}
else
{
$importedModule = Get-Module 'EntityFrameworkCore'
$moduleToImport = Test-ModuleManifest (Join-Path $PSScriptRoot 'EntityFrameworkCore.psd1')
$import = $true
if ($importedModule)
{
if ($importedModule.Version -le $moduleToImport.Version)
{
Remove-Module 'EntityFrameworkCore'
}
else
{
$import = $false
}
}
if ($import)
{
Import-Module $moduleToImport -DisableNameChecking
}
}