File tree Expand file tree Collapse file tree 1 file changed +26
-4
lines changed Expand file tree Collapse file tree 1 file changed +26
-4
lines changed Original file line number Diff line number Diff line change @@ -27,6 +27,12 @@ stages:
2727 displayName : ' Build'
2828 steps :
2929 - checkout : self
30+
31+ - task : UseDotNet@2
32+ displayName : ' .NET Core 6.0.x'
33+ inputs :
34+ version : ' 6.0.x'
35+ packageType : sdk
3036
3137 - task : DotNetCoreCLI@2
3238 name : restoreVulnerabilitiesSolution
@@ -36,13 +42,29 @@ stages:
3642 projects : $(Solution)
3743 verbosityRestore : normal
3844
39- - task : DotNetCoreCLI @2
45+ - task : PowerShell @2
4046 name : checkVulnerabilities
4147 displayName : ' Vulnerabilities check'
4248 inputs :
43- command : custom
44- custom : list
45- arguments : ' $(Solution) package --vulnerable --include-transitive'
49+ pwsh : true
50+ targetType : inline
51+ script : |
52+ $output = dotnet list "$(Solution)" package --vulnerable
53+ Write-Output $output
54+ $errors = $output | Select-String '>'
55+ if ($errors.Count -gt 0)
56+ {
57+ foreach ($err in $errors)
58+ {
59+ Write-Host "##vso[task.logissue type=error]Reference to vulnerable NuGet package $err"
60+ }
61+ exit 1
62+ }
63+ else
64+ {
65+ Write-Host "No vulnerable NuGet packages"
66+ exit 0
67+ }
4668
4769 - task : DotNetCoreCLI@2
4870 displayName : Build solution
You can’t perform that action at this time.
0 commit comments