@@ -266,7 +266,7 @@ task ReleaseBin -depends CleanWorking, UpdateVersion, Build {
266266 }
267267
268268 # check if is SDK project
269- $isSdk = Select-String - Path " $sourceDir \$projectFile " - Pattern ' <Project Sdk=" Microsoft.NET.Sdk"> ' - SimpleMatch - Quiet
269+ $isSdk = Select-String - Path " $sourceDir \$projectFile " - Pattern ' Microsoft.NET.Sdk' - SimpleMatch - Quiet
270270
271271 # copy project release files
272272 robocopy @ (" $projectDirectory \bin\Release" , " $workingDir \Bin\$projectName " , ' *.*' , ' /S' , ' /NP' , ' /XO' , ' /XF' , ' *.pdb' , ' *.xml' ) | Out-Default
@@ -479,18 +479,36 @@ task Test -depends Build {
479479 $projectDirectoryFileInfo = Get-ChildItem " $sourceDir \$projectFile "
480480 $projectDirectory = $projectDirectoryFileInfo.DirectoryName
481481
482- ForEach ($test in $tests )
482+ # check if is SDK project
483+ $isSdk = Select-String - Path " $sourceDir \$projectFile " - Pattern ' Microsoft.NET.Sdk' - SimpleMatch - Quiet
484+
485+ if ($isSdk )
483486 {
484- $targetFrameworks = GetTargetFrameworks($projectDirectoryFileInfo )
485- if ($projectName -eq $test.Name )
487+ ForEach ($test in $tests )
486488 {
487- ForEach ($targetFramework in $targetFrameworks )
488- {
489- $targetFrameworkName = $targetFramework.Name
490-
491- Write-Host - ForegroundColor Green " Running tests " $test.Name " on " $targetFrameworkName
492-
493- exec { dotnet test " $sourceDir \$projectFile " - c " Release" -f " $targetFrameworkName " | Out-Default }
489+ $targetFrameworks = GetTargetFrameworks($projectDirectoryFileInfo )
490+ if ($projectName -eq $test.Name )
491+ {
492+ ForEach ($targetFramework in $targetFrameworks )
493+ {
494+ $targetFrameworkName = $targetFramework.Name
495+
496+ Write-Host - ForegroundColor Green " Running tests " $test.Name " on " $targetFrameworkName
497+
498+ exec { dotnet test " $sourceDir \$projectFile " - c " Release" -f " $targetFrameworkName " | Out-Default }
499+ }
500+ }
501+ }
502+ }
503+ else
504+ {
505+ ForEach ($test in $tests )
506+ {
507+ if ($projectName -eq $test.Name )
508+ {
509+ Write-Host - ForegroundColor Green " Running tests " $test.Name
510+
511+ exec { dotnet test " $sourceDir \$projectFile " - c " Release" | Out-Default }
494512 }
495513 }
496514 }
@@ -627,4 +645,4 @@ function Update-VersionProjectFiles ([string] $solutionFile, [string] $versionNu
627645
628646 $xmlDoc.Save (" $sourceDir \$projectFile " )
629647 }
630- }
648+ }
0 commit comments