Skip to content

Commit 6cd987f

Browse files
committed
Update build.ps1
1 parent 0395b07 commit 6cd987f

File tree

1 file changed

+8
-20
lines changed

1 file changed

+8
-20
lines changed

build.ps1

Lines changed: 8 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,19 @@
1-
$Branch = "net5-develop"
21
$Version = "2020.9.0"
32
$IsPreview = $true
43

5-
$Uri = "https://github.com/BornToBeRoot/NETworkManager/archive/$Branch.zip"
4+
$BuildPath = "$PSScriptRoot\Build"
65

7-
$ScriptPath = $MyInvocation.MyCommand.Path
8-
$ScriptDir = Split-Path $ScriptPath
9-
10-
$TempFolder = "$ScriptDir\Temp"
11-
$DownloadedFile = "$TempFolder\download.zip"
12-
$BuildPath = "$ScriptDir\Build"
13-
14-
# Download from Github
15-
New-Item -ItemType Directory -Path $TempFolder
16-
Invoke-WebRequest -Uri $Uri -UseBasicParsing -OutFile $DownloadedFile -ErrorAction Stop
17-
18-
# Expand archive
19-
Expand-Archive -Path $DownloadedFile -DestinationPath $TempFolder
6+
if(Test-Path -Path $BuildPath)
7+
{
8+
Remove-Item $BuildPath -Recurse
9+
}
2010

2111
# Dotnet restore and build
22-
dotnet restore "$TempFolder\NETworkManager-$Branch\Source\NETworkManager.sln"
23-
dotnet build --configuration Release "$TempFolder\NETworkManager-$Branch\Source\NETworkManager.sln"
12+
dotnet restore "$PSScriptRoot\Source\NETworkManager.sln"
13+
dotnet build --configuration Release "$PSScriptRoot\Source\NETworkManager.sln"
2414

2515
# Copy files
26-
Copy-Item -Recurse -Path "$TempFolder\NETworkManager-$Branch\Source\NETworkManager\bin\Release\net5.0-windows" -Destination "$BuildPath\NETworkManager"
27-
28-
Remove-Item -Recurse -Path $TempFolder
16+
Copy-Item -Recurse -Path "$PSScriptRoot\Source\NETworkManager\bin\Release\net5.0-windows" -Destination "$BuildPath\NETworkManager"
2917

3018
# Is preview?
3119
if($IsPreview)

0 commit comments

Comments
 (0)