-
Notifications
You must be signed in to change notification settings - Fork 1
/
build-gui.ps1
28 lines (22 loc) · 1.06 KB
/
build-gui.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
param (
[string]$PathToSrc,
[string]$OutputDir = "./Releases",
[string]$Arch = "x64",
[string]$Configuration = "Release"
)
$csprojPath = "$PathToSrc/DIPOL-UF/DIPOL-UF.csproj"
# Restore and build project
MSBuild.exe $csprojPath -t:restore -verbosity:minimal
MSBuild.exe $csprojPath -p:Configuration=$Configuration -p:Platform=$Arch -verbosity:minimal
$regex = [System.Text.RegularExpressions.Regex]::new("^\s*\[assembly:\s*AssemblyVersion\s*\(\s*`"(\d+\.\d+.\d+)`"\s*\)\s*\]");
# Finds version string in the AssemblyInfo.cs
$version = Get-Content "$PathToSrc/DIPOL-UF/Properties/AssemblyInfo.cs" | `
ForEach-Object {$regex.Matches($_)} | `
Where-Object {$_.Success} | `
ForEach-Object {$_.Groups[1].Value}
# Creates output directory if it is missing
$dir = "$OutputDir/DIPOL-UF_$($Configuration)_$($Arch)_v$version"
New-Item $dir -Force -ItemType Directory -ErrorAction SilentlyContinue
# Copies items one by one
Get-ChildItem "$PathToSrc/DIPOL-UF/bin/$Arch/$Configuration/" | `
ForEach-Object {Copy-Item -Path $($_.FullName) -Destination "$dir\"}