Skip to content

Commit 5023f35

Browse files
authored
Merge pull request Azure#2790 from cormacpayne/strong-name-check
Add check to signing builds for strong name signature
2 parents 777f6c8 + 2d701e6 commit 5023f35

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

build.proj

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,9 @@
257257
ExpectedDelaySigned="false"
258258
ContinueOnError="false"
259259
Condition="!$(DelaySign) and '@(DelaySignedAssembliesToSign)' != ''"/>
260-
260+
261+
<Exec Command="$(PowerShellCommand) -NonInteractive -NoLogo -NoProfile -Command &quot;. $(LibraryToolsFolder)\CheckStrongNameSignature.ps1 &quot;"/>
262+
261263
<!-- Copying signed shortcut back -->
262264
<Copy SourceFiles="$(LibrarySourceFolder)\Package\$(Configuration)\AzureRM.psd1"
263265
DestinationFolder="$(LibraryRoot)tools\AzureRM" />

tools/CheckStrongNameSignature.ps1

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
function Check-StrongName {
2+
[CmdletBinding()]
3+
param([Parameter(ValueFromPipeline=$true)][string]$path)
4+
$output = & "sn.exe" -vf $path
5+
$length = $output.Length - 1
6+
if (-not $output[$length].Contains("is valid")) {
7+
Write-Output "$path has an invalid string name."
8+
}
9+
}
10+
11+
function Check-All {
12+
$invalidList = Get-ChildItem -Recurse -Filter *.dll | %{Check-StrongName -path $_.FullName}
13+
14+
if ($invalidList.Length -gt 0) {
15+
Write-Output($invalidList)
16+
throw "Strong name signature checked failed. One (or more) of the dlls has an invalid string name."
17+
}
18+
}

0 commit comments

Comments
 (0)