Skip to content

Commit 66e74dc

Browse files
committed
Missing artifactsDiagnosticsDll + fix Length error.
1 parent 0c90250 commit 66e74dc

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/ProjectTemplates/scripts/Test-Template.psm1

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,9 @@ 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"
114+
112115
# Remove all existing subdirectories (old versions)
113116
if (Test-Path $packsDir) {
114117
Get-ChildItem $packsDir -Directory | Remove-Item -Recurse -Force -ErrorAction Ignore
@@ -379,7 +382,7 @@ function Test-Template {
379382
New-Item -ErrorAction Ignore -Path $tmpDir -ItemType Directory | Out-Null;
380383
Push-Location $tmpDir -StackName TemplateFolder;
381384
try {
382-
$TemplateArguments = , "new" + $TemplateArguments + , "--no-restore";
385+
$TemplateArguments = @("new") + @($TemplateArguments) + @("--no-restore");
383386
Write-Verbose "Running dotnet command with arguments: $TemplateArguments";
384387
Write-Verbose "Current working directory: $(Get-Location)"
385388
Write-Verbose "About to run dotnet new - checking dotnet version one more time:"
@@ -390,9 +393,9 @@ function Test-Template {
390393
Write-Verbose "Template creation completed. Checking created files:"
391394
Get-ChildItem . -Recurse -File | Select-Object -First 10 | ForEach-Object { Write-Verbose " $($_.FullName)" }
392395

393-
$proj = Get-ChildItem $tmpDir -Recurse -File -Filter '*.csproj' -Depth 3;
394-
if ($proj.Length -eq 0) {
395-
$proj = Get-ChildItem $tmpDir -Recurse -File -Filter '*.fsproj' -Depth 3;
396+
$proj = @(Get-ChildItem $tmpDir -Recurse -File -Filter '*.csproj' -Depth 3)
397+
if ($proj.Count -eq 0) {
398+
$proj = @(Get-ChildItem $tmpDir -Recurse -File -Filter '*.fsproj' -Depth 3)
396399
}
397400

398401
$importPath = "$PSScriptRoot/../test/Templates.Tests/bin/$Configuration/$TargetFramework/TestTemplates";

0 commit comments

Comments
 (0)