-
Notifications
You must be signed in to change notification settings - Fork 1
/
run_publish.ps1
56 lines (43 loc) · 1.33 KB
/
run_publish.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
Param(
[Switch]$Release
)
$Folder = "debug"
if ($Release) {
$Folder = "release"
}
Write-Host "`n---------- Removing publish directories ----------`n"
function Remove-Folder {
param([string] $FolderPath)
if (Test-Path $FolderPath) {
Write-Host "Removing folder $FolderPath"
Remove-Item -Recurse -Force $FolderPath | Out-Null
if (Test-Path $FolderPath) {
throw "The folder at path $FolderPath could not be deleted."
}
}
}
Remove-Folder ./publish
Remove-Folder ./SteganographyApp/bin/$Folder
Write-Host "`n---------- Publishing $Folder build ----------`n"
dotnet publish -c $Folder
if($LastExitCode -ne 0){
Write-Host "publish failed with status: $LastExitCode"
Exit
}
Write-Host "`n---------- Copying publish output ----------`n"
function Copy-Folder {
param(
[string] $Project,
[string] $Output,
[string] $Rename
)
Write-Host "Copying output from $Project publish"
Copy-Item ./$Project/bin/$Folder/netcoreapp8.0/publish -Recurse -Destination $Output
Get-ChildItem -Path ./$Project/bin/$Folder/netcoreapp8.0/ | Where-Object Name -Like "*.dll" | Copy-Item -Force -Destination ./publish
if (-Not($Rename -eq "")) {
cd publish
Rename-Item -Path publish -NewName $Rename
cd ..
}
}
Copy-Folder "SteganographyApp" "."