File tree Expand file tree Collapse file tree 1 file changed +40
-0
lines changed Expand file tree Collapse file tree 1 file changed +40
-0
lines changed Original file line number Diff line number Diff line change
1
+ <#
2
+ . SYNOPSIS
3
+ Unzips an AspNetCore.App.Ref nupkg
4
+ . DESCRIPTION
5
+ This script unzips an AspNetCore.App.Ref nupkg
6
+ . PARAMETER RefPath
7
+ The path to the AspNetCore.App.Ref package to install.
8
+ . PARAMETER InstallDir
9
+ The directory to install to.
10
+ #>
11
+ param (
12
+ [Parameter (Mandatory = $true )]
13
+ $RefPath ,
14
+
15
+ [Parameter (Mandatory = $true )]
16
+ $InstallDir ,
17
+ )
18
+
19
+ $ErrorActionPreference = ' Stop'
20
+ $ProgressPreference = ' SilentlyContinue' # Workaround PowerShell/PowerShell#2138
21
+
22
+ Set-StrictMode - Version 1
23
+
24
+ Write-Host " Extracting to $InstallDir "
25
+
26
+ $zipPackage = [io.path ]::ChangeExtension($RefPath , " .zip" )
27
+ Write-Host " Renaming to $zipPackage "
28
+ Rename-Item - Path $RefPath - NewName $zipPackage
29
+ if (Get-Command - Name ' Microsoft.PowerShell.Archive\Expand-Archive' - ErrorAction Ignore) {
30
+ # Use built-in commands where possible as they are cross-plat compatible
31
+ Microsoft.PowerShell.Archive\Expand-Archive - Path $zipPackage - DestinationPath " $InstallDir " - Force
32
+ }
33
+ else {
34
+ Remove-Item " $InstallDir " - Recurse - ErrorAction Ignore
35
+ # Fallback to old approach for old installations of PowerShell
36
+ Add-Type - AssemblyName System.IO.Compression.FileSystem
37
+ [System.IO.Compression.ZipFile ]::ExtractToDirectory($zipPackage , " $InstallDir " )
38
+ }
39
+
40
+ Get-ChildItem - Path " $InstallDir " - Recurse
You can’t perform that action at this time.
0 commit comments