@@ -12,6 +12,12 @@ $projectFile = Join-Path $scriptDir "AgentLauncher.csproj"
1212$configuration = " Debug"
1313$platform = " x64"
1414
15+ # Calculate paths for uriHandler bundle
16+ $uriHandlerPath = Join-Path $scriptDir " ..\..\..\ts\packages\uriHandler" | Resolve-Path - ErrorAction SilentlyContinue
17+ $bundleOutput = if ($uriHandlerPath ) { Join-Path $uriHandlerPath " bundle\agent-uri-handler.bundle.js" } else { $null }
18+ $targetDir = Join-Path $scriptDir " Scripts"
19+ $targetPath = Join-Path $targetDir " agent-uri-handler.bundle.js"
20+
1521# Find MSBuild
1622$msbuildPath2022 = " C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\Bin\MSBuild.exe" ;
1723$msbuildPath2026 = " C:\Program Files\Microsoft Visual Studio\18\Enterprise\MSBuild\Current\Bin\MSBuild.exe" ;
@@ -34,14 +40,46 @@ Write-Host " Configuration: $configuration"
3440Write-Host " Platform: $platform "
3541Write-Host " "
3642
43+ # Copy bundle from uriHandler
44+ Write-Host " Step 1: Copying uriHandler bundle..." - ForegroundColor Yellow
45+ if (-not $bundleOutput -or -not (Test-Path $bundleOutput )) {
46+ Write-Host " "
47+ Write-Host " ERROR: Bundle file not found at: $bundleOutput " - ForegroundColor Red
48+ Write-Host " "
49+ Write-Host " You must first build the uriHandler package:" - ForegroundColor Yellow
50+ if ($uriHandlerPath ) {
51+ Write-Host " 1. Navigate to: $uriHandlerPath " - ForegroundColor Cyan
52+ } else {
53+ Write-Host " 1. Navigate to the uriHandler package directory" - ForegroundColor Cyan
54+ }
55+ Write-Host " 2. Run: pnpm run build" - ForegroundColor Cyan
56+ Write-Host " "
57+ exit 1
58+ }
59+
60+ $bundleSize = (Get-Item $bundleOutput ).Length
61+ $bundleSizeKB = [Math ]::Round($bundleSize / 1 KB , 2 )
62+ Write-Host " Bundle found: $bundleSizeKB KB at $bundleOutput " - ForegroundColor Green
63+
64+ New-Item - ItemType Directory - Force - Path $targetDir | Out-Null
65+ Copy-Item $bundleOutput $targetPath - Force
66+
67+ if (Test-Path $targetPath ) {
68+ Write-Host " Bundle copied successfully to: $targetPath " - ForegroundColor Green
69+ } else {
70+ Write-Host " ERROR: Failed to copy bundle" - ForegroundColor Red
71+ exit 1
72+ }
73+ Write-Host " "
74+
3775# Clean previous build
38- Write-Host " Step 1 : Cleaning previous build..." - ForegroundColor Yellow
76+ Write-Host " Step 2 : Cleaning previous build..." - ForegroundColor Yellow
3977Remove-Item - Recurse - Force obj, bin - ErrorAction SilentlyContinue
4078Write-Host " Clean complete" - ForegroundColor Green
4179Write-Host " "
4280
4381# Build
44- Write-Host " Step 2 : Building project..." - ForegroundColor Yellow
82+ Write-Host " Step 3 : Building project..." - ForegroundColor Yellow
4583$buildArgs = @ (
4684 $projectFile ,
4785 " -t:Restore,Build" ,
@@ -62,7 +100,7 @@ Write-Host " Build complete" -ForegroundColor Green
62100Write-Host " "
63101
64102# Package
65- Write-Host " Step 3 : Creating MSIX package..." - ForegroundColor Yellow
103+ Write-Host " Step 4 : Creating MSIX package..." - ForegroundColor Yellow
66104$packageArgs = @ (
67105 $projectFile ,
68106 " -t:_GenerateAppxPackage" ,
0 commit comments