-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.ps1
More file actions
33 lines (28 loc) · 1.13 KB
/
Copy pathbuild.ps1
File metadata and controls
33 lines (28 loc) · 1.13 KB
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
# Builds bin\MatrixRainer.exe with the C# compiler that ships inside every
# Windows install (.NET Framework 4.8). No SDK or NuGet restore required.
$ErrorActionPreference = 'Stop'
$root = Split-Path -Parent $MyInvocation.MyCommand.Path
$csc = Join-Path $env:WINDIR 'Microsoft.NET\Framework64\v4.0.30319\csc.exe'
if (-not (Test-Path $csc)) {
$csc = Join-Path $env:WINDIR 'Microsoft.NET\Framework\v4.0.30319\csc.exe'
}
$bin = Join-Path $root 'bin'
New-Item -ItemType Directory -Force $bin | Out-Null
$icon = Join-Path $root 'assets\MatrixRainer.ico'
if (-not (Test-Path $icon)) {
& (Join-Path $root 'tools\make-icon.ps1')
}
$cscArgs = @(
'/nologo', '/target:winexe', '/optimize+', '/warn:4', '/codepage:65001', '/unsafe+',
('/out:' + (Join-Path $bin 'MatrixRainer.exe')),
('/win32icon:' + $icon),
('/win32manifest:' + (Join-Path $root 'src\app.manifest')),
'/r:System.dll',
'/r:System.Core.dll',
'/r:System.Drawing.dll',
'/r:System.Windows.Forms.dll',
(Join-Path $root 'src\*.cs')
)
& $csc $cscArgs
if ($LASTEXITCODE -ne 0) { throw 'csc failed' }
Write-Output ("built " + (Join-Path $bin 'MatrixRainer.exe'))