Skip to content

Commit 562a306

Browse files
committed
Force reload module for debugging + do not run dotnet pack when previous CI commands already packed into shipping artifacts.
1 parent 03d35ca commit 562a306

File tree

2 files changed

+11
-10
lines changed

2 files changed

+11
-10
lines changed

src/ProjectTemplates/scripts/Run-BlazorWeb-Locally.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@
7878
$templateArguments += "--use-program-main"
7979
}
8080

81-
Import-Module -Name "$PSScriptRoot/Test-Template.psm1";
81+
Import-Module -Name "$PSScriptRoot/Test-Template.psm1" -Force;
8282

8383
Test-Template `
8484
-TemplateName "MyBlazorApp" `

src/ProjectTemplates/scripts/Test-Template.psm1

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -172,17 +172,18 @@ function Test-Template {
172172
$tmpDir = "$PSScriptRoot/$templateName";
173173
Write-Verbose "Template working directory: $tmpDir"
174174
Remove-Item -Path $tmpDir -Recurse -ErrorAction Ignore;
175-
Write-Verbose "Running dotnet pack to build template packages..."
176-
Push-Location ..;
177-
try {
178-
Write-Verbose "Current location for dotnet pack: $(Get-Location)"
179-
dotnet pack
180-
}
181-
finally {
182-
Pop-Location;
175+
176+
# Check if template packages exist (should be built by main CI build process)
177+
$PackagePathPattern = "$PSScriptRoot/../../../artifacts/packages/$Configuration/Shipping/$TemplatePackagePath"
178+
Write-Verbose "Looking for template packages at: $PackagePathPattern"
179+
180+
$PackagePath = Get-ChildItem -Path "$PSScriptRoot/../../../artifacts/packages/$Configuration/Shipping/" -Filter $TemplatePackagePath -ErrorAction SilentlyContinue | Select-Object -First 1
181+
if (-not $PackagePath) {
182+
Write-Error "Template packages not found at $PackagePathPattern. Ensure the main build has completed with -pack option before running template tests."
183+
return
183184
}
184185

185-
$PackagePath = Resolve-Path "$PSScriptRoot/../../../artifacts/packages/$Configuration/Shipping/$TemplatePackagePath";
186+
$PackagePath = $PackagePath.FullName
186187
Write-Verbose "Template package path: $PackagePath"
187188

188189
$PackageName = (Get-Item $PackagePath).Name;

0 commit comments

Comments
 (0)