This repository has been archived by the owner on Aug 21, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
build.ps1
69 lines (52 loc) · 1.73 KB
/
build.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
57
58
59
60
61
62
63
64
65
66
67
68
69
param([string]$buildtfm = 'all')
$ErrorActionPreference = 'Stop'
Write-Host 'dotnet SDK version'
dotnet --version
$exe = 'SeewoHelper.exe'
$net_tfm = 'net5.0-windows'
$dllpatcher_tfm = 'net5.0'
$configuration = 'Release'
$output_dir = "src\bin\$configuration"
$dllpatcher_dir = "build\DotNetDllPathPatcher"
$dllpatcher_exe = "$dllpatcher_dir\bin\$configuration\$dllpatcher_tfm\DotNetDllPathPatcher.exe"
$proj_path = "src\SeewoHelper.csproj"
$build = $buildtfm -eq 'all' -or $buildtfm -eq 'app'
$buildX86 = $buildtfm -eq 'all' -or $buildtfm -eq 'x86'
$buildX64 = $buildtfm -eq 'all' -or $buildtfm -eq 'x64'
function Build-App
{
Write-Host 'Building .NET App'
$outdir = "$output_dir\$net_tfm"
$publishDir = "$outdir\publish"
Remove-Item $publishDir -Recurse -Force -Confirm:$false -ErrorAction Ignore
dotnet publish -c $configuration -f $net_tfm $proj_path
if ($LASTEXITCODE) { exit $LASTEXITCODE }
& $dllpatcher_exe $publishDir\$exe bin
if ($LASTEXITCODE) { exit $LASTEXITCODE }
}
function Build-SelfContained
{
param([string]$rid)
Write-Host "Building .NET App SelfContained $rid"
$outdir = "$output_dir\$net_tfm\$rid"
$publishDir = "$outdir\publish"
Remove-Item $publishDir -Recurse -Force -Confirm:$false -ErrorAction Ignore
dotnet publish -c $configuration -f $net_tfm -r $rid --self-contained true -p:PublishTrimmed=false $proj_path
if ($LASTEXITCODE) { exit $LASTEXITCODE }
& $dllpatcher_exe $publishDir\$exe bin
if ($LASTEXITCODE) { exit $LASTEXITCODE }
}
dotnet build -c $configuration -f $dllpatcher_tfm $dllpatcher_dir\DotNetDllPathPatcher.csproj
if ($LASTEXITCODE) { exit $LASTEXITCODE }
if ($build)
{
Build-App
}
if ($buildX64)
{
Build-SelfContained win-x64
}
if ($buildX86)
{
Build-SelfContained win-x86
}