Skip to content

Add check to signing builds for strong name signature #2790

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 24, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion build.proj
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,9 @@
ExpectedDelaySigned="false"
ContinueOnError="false"
Condition="!$(DelaySign) and '@(DelaySignedAssembliesToSign)' != ''"/>


<Exec Command="$(PowerShellCommand) -NonInteractive -NoLogo -NoProfile -Command &quot;. $(LibraryToolsFolder)\CheckStrongNameSignature.ps1 &quot;"/>

<!-- Copying signed shortcut back -->
<Copy SourceFiles="$(LibrarySourceFolder)\Package\$(Configuration)\AzureRM.psd1"
DestinationFolder="$(LibraryRoot)tools\AzureRM" />
Expand Down
18 changes: 18 additions & 0 deletions tools/CheckStrongNameSignature.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
function Check-StrongName {
[CmdletBinding()]
param([Parameter(ValueFromPipeline=$true)][string]$path)
$output = & "sn.exe" -vf $path
$length = $output.Length - 1
if (-not $output[$length].Contains("is valid")) {
Write-Output "$path has an invalid string name."
}
}

function Check-All {
$invalidList = Get-ChildItem -Recurse -Filter *.dll | %{Check-StrongName -path $_.FullName}

if ($invalidList.Length -gt 0) {
Write-Output($invalidList)
throw "Strong name signature checked failed. One (or more) of the dlls has an invalid string name."
}
}