@@ -109,29 +109,38 @@ function Test-Template {
109109 $psScriptDiagnosticsDll = " $PSScriptRoot /.dotnet/shared/Microsoft.AspNetCore.App/10.0.0-dev/Microsoft.AspNetCore.Diagnostics.dll" ;
110110 Check- DiagnosticsDll - Path $psScriptDiagnosticsDll - Description " 1) PSScriptRoot Microsoft.AspNetCore.Diagnostics.dll before patching" ;
111111
112- # Initialize artifactsDiagnosticsDll path
113- $artifactsDiagnosticsDll = " $PSScriptRoot /../../../artifacts/bin/Microsoft.AspNetCore.Diagnostics/$Configuration /$TargetFramework /Microsoft.AspNetCore.Diagnostics.dll"
112+ # Find the built runtime zip file
113+ $builtRuntimePattern = " $PSScriptRoot /../../../artifacts/packages/$Configuration /Shipping/aspnetcore-runtime-*-dev-win-x64.zip"
114+ $builtRuntime = Get-ChildItem $builtRuntimePattern - ErrorAction SilentlyContinue | Select-Object - First 1 | Select-Object - ExpandProperty FullName
115+ if (-not $builtRuntime ) {
116+ Write-Error " Built runtime package not found at pattern: $builtRuntimePattern . Ensure the main build has completed with -pack option."
117+ return
118+ }
119+ Write-Verbose " Built runtime package: $builtRuntime " ;
114120
115- # Remove all existing subdirectories (old versions)
116- if (Test-Path $packsDir ) {
117- Get-ChildItem $packsDir - Directory | Remove-Item - Recurse - Force - ErrorAction Ignore
118- Write-Verbose " Removed all existing reference pack versions from: $packsDir "
119- }
121+ # [dll check] 3) Check Microsoft.AspNetCore.Diagnostics.dll in artifacts
122+ $artifactsDiagnosticsDll = " $PSScriptRoot /../../../artifacts/bin/Microsoft.AspNetCore.Diagnostics/$Configuration /$TargetFramework /Microsoft.AspNetCore.Diagnostics.dll" ;
120123
121- # Check if dev version of reference assemblies exist in the runtime zip
122- $devRefAssembliesSource = " $PSScriptRoot /.runtime/ref/Microsoft.AspNetCore.App"
123- if (Test-Path $devRefAssembliesSource ) {
124- Write-Verbose " Found dev reference assemblies in runtime zip at: $devRefAssembliesSource "
125- $devRefPackDir = " $packsDir /10.0.0-dev"
126- # Remove any existing dev reference pack directory first
127- if (Test-Path $devRefPackDir ) {
128- Remove-Item - Path $devRefPackDir - Recurse - Force - ErrorAction Ignore
129- }
130- New-Item - Path $devRefPackDir - ItemType Directory - Force | Out-Null
131- # Copy the entire structure from the dev ref assemblies source
132- Copy-Item - Path " $devRefAssembliesSource /*" - Destination $devRefPackDir - Recurse - Force
133- Write-Verbose " Successfully copied dev reference assemblies to $devRefPackDir "
124+ # Remove all existing subdirectories (old versions)
125+ if (Test-Path $packsDir ) {
126+ Get-ChildItem $packsDir - Directory | Remove-Item - Recurse - Force - ErrorAction Ignore
127+ Write-Verbose " Removed all existing reference pack versions from: $packsDir "
128+ }
129+
130+ # Check if dev version of reference assemblies exist in the runtime zip
131+ $devRefAssembliesSource = " $PSScriptRoot /.runtime/ref/Microsoft.AspNetCore.App"
132+ if (Test-Path $devRefAssembliesSource ) {
133+ Write-Verbose " Found dev reference assemblies in runtime zip at: $devRefAssembliesSource "
134+ $devRefPackDir = " $packsDir /10.0.0-dev"
135+ # Remove any existing dev reference pack directory first
136+ if (Test-Path $devRefPackDir ) {
137+ Remove-Item - Path $devRefPackDir - Recurse - Force - ErrorAction Ignore
134138 }
139+ New-Item - Path $devRefPackDir - ItemType Directory - Force | Out-Null
140+ # Copy the entire structure from the dev ref assemblies source
141+ Copy-Item - Path " $devRefAssembliesSource /*" - Destination $devRefPackDir - Recurse - Force
142+ Write-Verbose " Successfully copied dev reference assemblies to $devRefPackDir "
143+ }
135144 if (-not (Check- DiagnosticsDll - Path $artifactsDiagnosticsDll - Description " 3) Artifacts Microsoft.AspNetCore.Diagnostics.dll" )) {
136145 # Try alternative location
137146 $artifactsDiagnosticsDll2 = " $PSScriptRoot /../../../artifacts/packages/$Configuration /Shipping/Microsoft.AspNetCore.Diagnostics.$TargetFramework .*.nupkg" ;
0 commit comments