add onnx and metadata
This commit is contained in:
1 parent
98d9fa24cf
commit
5f3f915258
18 files changed
+2229
-78
No files matched your search
+34
-9
@@ -1,10 +1,35 @@
|
||||
$csc = "C:\Windows\Microsoft.NET\Framework64\v4.0.30319\csc.exe"
|
||||
if (-not (Test-Path $csc)) {
|
||||
$csc = "C:\Windows\Microsoft.NET\Framework\v4.0.30319\csc.exe"
|
||||
$ErrorActionPreference = 'Stop'
|
||||
$work = Join-Path ([System.IO.Path]::GetTempPath()) ('ldcc-publish-' + [Guid]::NewGuid().ToString('N'))
|
||||
$exitCode = 1
|
||||
try {
|
||||
if (-not (Get-Command dotnet -ErrorAction SilentlyContinue)) {
|
||||
throw 'dotnet SDK non trovato. Installare un SDK compatibile con .NET 8.'
|
||||
}
|
||||
$publish = Join-Path $work 'publish'
|
||||
$obj = (Join-Path $work 'obj') + '\'
|
||||
$output = (Join-Path $work 'build') + '\'
|
||||
& dotnet publish (Join-Path $PSScriptRoot 'LoopbackCapture.csproj') -c Release -o $publish "-p:BaseIntermediateOutputPath=$obj" "-p:BaseOutputPath=$output"
|
||||
$exitCode = $LASTEXITCODE
|
||||
if ($exitCode -eq 0) {
|
||||
try {
|
||||
$built = Get-Item (Join-Path $publish 'LoopbackCapture.exe')
|
||||
# Guardia: un self-contained single-file pesa decine di MB. Poche centinaia di
|
||||
# KB significano publish framework-dependent, che su un PC senza runtime .NET
|
||||
# non parte. Meglio fallire qui che distribuire un exe che non si avvia.
|
||||
if ($built.Length -lt 20MB) {
|
||||
throw "publish inatteso: $($built.Length) byte. Atteso self-contained (>20 MB): controllare SelfContained/RuntimeIdentifier/PublishSingleFile in LoopbackCapture.csproj."
|
||||
}
|
||||
Copy-Item $built.FullName (Join-Path $PSScriptRoot 'LoopbackCapture.exe') -Force
|
||||
Write-Output ("Build completata: bin\LoopbackCapture.exe ({0:N0} byte, self-contained .NET 8)." -f $built.Length)
|
||||
} catch {
|
||||
$exitCode = 1
|
||||
Write-Error "Impossibile aggiornare bin\LoopbackCapture.exe: file in uso o accesso negato. Chiudere il bridge e ripetere la build. $($_.Exception.Message)" -ErrorAction Continue
|
||||
}
|
||||
}
|
||||
} catch {
|
||||
$exitCode = 1
|
||||
Write-Error $_ -ErrorAction Continue
|
||||
} finally {
|
||||
if (Test-Path $work) { Remove-Item $work -Recurse -Force -ErrorAction SilentlyContinue }
|
||||
}
|
||||
if (-not (Test-Path $csc)) {
|
||||
Write-Error "Compilatore .NET Framework csc.exe non trovato (Framework64 / Framework)."
|
||||
exit 1
|
||||
}
|
||||
& $csc /nologo /unsafe /optimize+ /target:exe /out:bin\LoopbackCapture.exe bin\LoopbackCapture.cs
|
||||
exit $LASTEXITCODE
|
||||
exit $exitCode
|
||||
Reference in new issue
Block a user