Skip to content

Commit da57fa9

Browse files
author
Javad Rahnama
authored
Eng | Add strong name validation to package validator (#2802) (#2803)
1 parent 56720a0 commit da57fa9

File tree

1 file changed

+36
-1
lines changed

1 file changed

+36
-1
lines changed

eng/pipelines/common/templates/jobs/validate-signed-package-job.yml

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,42 @@ jobs:
110110
}
111111
displayName: 'Verify nuget signature'
112112
113+
- powershell: |
114+
if($env:CDP_BUILD_TYPE -eq 'Official')
115+
{
116+
# Recursively find all .dll files in TempFolder (installed nuget folder)
117+
# Microsoft.Data.SqlClient.dll and Microsoft.Data.SqlClient.resources.dll (in localized folders) should have strong name
118+
$dllFiles = Get-ChildItem -Path $(TempFolderName) -Recurse -Filter *.dll
119+
$badDlls = @()
120+
foreach ($file in $dllFiles)
121+
{
122+
# Run sn.k to verify the strong name on each dll
123+
$result = & "C:\Program Files (x86)\Microsoft SDKs\Windows\*\bin\NETFX 4.8.1 Tools\sn.exe" -vf $file.FullName
124+
Write-OutPut $result
125+
126+
# if thhe dll is not valid, it would be delay signed or test-signed which is not meant for production
127+
if($result[$result.Length-1] -notlike "* is valid")
128+
{
129+
$badDlls += $result[$result.Length-1]
130+
}
131+
}
132+
if($badDlls.Count -gt 0)
133+
{
134+
Write-OutPut "Error: Invalid dlls are detected. Chek below list:"
135+
foreach($dll in $badDlls)
136+
{
137+
Write-Output $dll
138+
}
139+
Exit -1
140+
}
141+
Write-Host "Strong name has been verified for all dlls"
142+
}
143+
else
144+
{
145+
Write-OutPut "Strong name verification is not required for non-official builds"
146+
}
147+
displayName: 'Verify strong name is generated for production'
148+
113149
- powershell: |
114150
# Checks the expected folder names such as lib, ref, runtimes
115151
Get-ChildItem -Path $(extractedNugetPath) -Directory | select Name | foreach {
@@ -212,7 +248,6 @@ jobs:
212248
}
213249
}
214250
displayName: 'Verify all DLLs unzipped match "expected" hierarchy'
215-
216251
- powershell: |
217252
# Verify all dlls status are Valid
218253

0 commit comments

Comments
 (0)