Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
rogierandCursor committed 2026-11-09 16:36:28 +01:00
1 parent 5bdc851fa0
commit 67c98c7c0a
19 files changed
+447 -58

No files matched your search

+35 -15
View File
@@ -1,19 +1,27 @@
# Publiceert kniip als zelfstandige single-file exe (geen .NET-installatie nodig op de doel-pc)
# Publiceert kniip als zelfstandige single-file exe (geen .NET-installatie nodig op de doel-pc)
# en bouwt de installer als Inno Setup 6 aanwezig is.
# ScreenRecorderLib (screencasts) is een C++/CLI-assembly die niet uit de bundel geladen kan worden;
# IncludeAllContentForSelfExtract pakt daarom bij de eerste start alles uit naar %TEMP%\.net.
#
# .\build.ps1 -> artifacts\publish\Kniip.exe (+ installer indien mogelijk)
#
# Elke build levert ook artifacts\KniipTest-<versie>.exe: een testversie met eigen register-, instellingen-
# en mutexnamen (KniipTest), die naast de geïnstalleerde kniip draait zonder diens registratie te raken.
#
# .\build.ps1 -> artifacts\publish\Kniip.exe (+ installer indien mogelijk) + testexe
# .\build.ps1 -Version 1.2.0
# .\build.ps1 -SkipTest -> zonder testexe
param(
[string]$Version = "1.1.3",
[string]$Runtime = "win-x64"
[string]$Version = "1.1.4",
[string]$Runtime = "win-x64",
[switch]$SkipTest
)
$ErrorActionPreference = "Stop"
$root = $PSScriptRoot
$project = Join-Path $root "src\Kniip\Kniip.csproj"
$publishDir = Join-Path $root "artifacts\publish"
$testPublishDir = Join-Path $root "artifacts\publish-test"
# Gebruik een SDK in het gebruikersprofiel als er geen systeembrede SDK is.
$localDotnet = Join-Path $env:LOCALAPPDATA "Microsoft\dotnet"
@@ -22,18 +30,23 @@ if (-not (dotnet --list-sdks 2>$null) -and (Test-Path (Join-Path $localDotnet "d
$env:PATH = "$localDotnet;$env:PATH"
}
if (Test-Path $publishDir) { Remove-Item $publishDir -Recurse -Force }
function Publish-Kniip([string]$outputDir, [bool]$test) {
if (Test-Path $outputDir) { Remove-Item $outputDir -Recurse -Force }
dotnet publish (Join-Path $root "src\Kniip\Kniip.csproj") `
-c Release -r $Runtime --self-contained true `
-p:PublishSingleFile=true `
-p:IncludeNativeLibrariesForSelfExtract=true `
-p:IncludeAllContentForSelfExtract=true `
-p:EnableCompressionInSingleFile=true `
-p:DebugType=none `
-p:Version=$Version `
-o $publishDir
if ($LASTEXITCODE -ne 0) { throw "dotnet publish is mislukt." }
dotnet publish $project `
-c Release -r $Runtime --self-contained true `
-p:PublishSingleFile=true `
-p:IncludeNativeLibrariesForSelfExtract=true `
-p:IncludeAllContentForSelfExtract=true `
-p:EnableCompressionInSingleFile=true `
-p:DebugType=none `
-p:Version=$Version `
-p:KniipTest=$($test.ToString().ToLowerInvariant()) `
-o $outputDir
if ($LASTEXITCODE -ne 0) { throw "dotnet publish is mislukt." }
}
Publish-Kniip $publishDir $false
Write-Host "Gepubliceerd: $publishDir\Kniip.exe" -ForegroundColor Green
@@ -55,3 +68,10 @@ if ($iscc) {
} else {
Write-Host "Inno Setup 6 niet gevonden; installer overgeslagen (winget install JRSoftware.InnoSetup)." -ForegroundColor Yellow
}
if (-not $SkipTest) {
Publish-Kniip $testPublishDir $true
$testExe = Join-Path $root "artifacts\KniipTest-$Version.exe"
Copy-Item (Join-Path $testPublishDir "Kniip.exe") $testExe -Force
Write-Host "Testversie: $testExe" -ForegroundColor Green
}