11$ErrorActionPreference = ' Stop'
22Set-StrictMode - Version Latest
33
4- $repoRoot = Resolve -Path ( Join -Path $PSScriptRoot ' ..\.. ' )
4+ $repoRoot = Split -Path - Parent ( Split -Path - Parent $PSScriptRoot )
55$srcRoot = Join-Path $repoRoot ' src'
66$configuration = if ($env: CONFIGURATION ) { $env: CONFIGURATION } else { ' Release' }
77
8- $daemonDll = Join-Path $srcRoot " UniGetUI.Avalonia\bin\$configuration \net10.0\UniGetUI.Avalonia.dll"
9- $cliDll = Join-Path $srcRoot " UniGetUI.Cli\bin\$configuration \net10.0\UniGetUI.Cli.dll"
8+ function Resolve-BuildArtifact {
9+ param (
10+ [Parameter (Mandatory = $true )]
11+ [string ] $ProjectName ,
12+ [Parameter (Mandatory = $true )]
13+ [string ] $AssemblyName
14+ )
15+
16+ $binRoot = Join-Path (Join-Path $srcRoot $ProjectName ) ' bin'
17+ $separator = [System.IO.Path ]::DirectorySeparatorChar
18+ $configurationSegment = [string ]::Concat($separator , $configuration , $separator )
19+ $targetFrameworkSegment = [string ]::Concat($separator , ' net10.0' , $separator )
20+
21+ $candidate = Get-ChildItem - Path $binRoot - Recurse - Filter $AssemblyName - File - ErrorAction SilentlyContinue |
22+ Where-Object { $_.FullName.Contains ($configurationSegment ) -and $_.FullName.Contains ($targetFrameworkSegment ) } |
23+ Sort-Object LastWriteTimeUtc - Descending |
24+ Select-Object - First 1
25+
26+ if ($null -eq $candidate ) {
27+ throw " Assembly $AssemblyName not found under $binRoot "
28+ }
29+
30+ return $candidate.FullName
31+ }
32+
33+ $daemonDll = Resolve-BuildArtifact - ProjectName ' UniGetUI.Avalonia' - AssemblyName ' UniGetUI.Avalonia.dll'
34+ $cliDll = Resolve-BuildArtifact - ProjectName ' UniGetUI.Cli' - AssemblyName ' UniGetUI.Cli.dll'
1035
1136if (-not (Test-Path $daemonDll )) {
1237 throw " Daemon assembly not found at $daemonDll "
@@ -16,6 +41,9 @@ if (-not (Test-Path $cliDll)) {
1641 throw " CLI assembly not found at $cliDll "
1742}
1843
44+ $daemonDll = (Resolve-Path $daemonDll ).Path
45+ $cliDll = (Resolve-Path $cliDll ).Path
46+
1947$daemonRoot = Join-Path ([System.IO.Path ]::GetTempPath()) (" unigetui-headless-" + [Guid ]::NewGuid().ToString(' N' ))
2048New-Item - ItemType Directory - Path $daemonRoot | Out-Null
2149
0 commit comments