Skip to content

Commit 9f14e52

Browse files
authored
Merge pull request #288 from twcclegg/snk
Add strong name
2 parents 2d3f443 + d7124e6 commit 9f14e52

9 files changed

+44
-0
lines changed

.github/workflows/build_and_run_unit_tests_linux.yml

+3
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ jobs:
1515
uses: actions/setup-dotnet@v4
1616
with:
1717
dotnet-version: 9.x
18+
- name: Add snk for strong name signing
19+
run: |
20+
echo "${{ secrets.KEY_SNK_B64 }}" | base64 --decode > key.snk
1821
- name: Add zip files required for running tests
1922
run: |
2023
(cd resources/geocoding; zip -r ../../resources/geocoding.zip *)

.github/workflows/run_all_tests_and_upload_code_coverage.yml

+4
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ jobs:
1616
uses: actions/setup-dotnet@v4
1717
with:
1818
dotnet-version: 9.x
19+
- name: Add key.snk for strong name signing
20+
run: |
21+
echo "${{ secrets.KEY_SNK_B64 }}" | Out-File key.snk.b64
22+
certutil -decode key.snk.b64 key.snk
1923
- name: Add zip files required for running tests
2024
run: |
2125
Compress-Archive -Path "resources\geocoding\*" -DestinationPath "resources\geocoding.zip"

.github/workflows/run_performance_tests_windows.yml

+4
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ jobs:
1212
timeout-minutes: 20
1313
steps:
1414
- uses: actions/checkout@v4
15+
- name: Add key.snk for strong name signing
16+
run: |
17+
echo "${{ secrets.KEY_SNK_B64 }}" | Out-File key.snk.b64
18+
certutil -decode key.snk.b64 key.snk
1519
- name: Setup .NET
1620
uses: actions/setup-dotnet@v4
1721
with:

appveyor.yml

+4
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,16 @@ configuration: Release
1717
environment:
1818
COVERALLS_REPO_TOKEN:
1919
secure: vncyomjYijKQKcbLpvs7DFLyNWPjW7tk9KNF/bTV5J/RxOnFydZfsJSsp7SMlvUg
20+
KEY_SNK_B64:
21+
secure: 4AsBl6Xj6lf78x5EnMNljK0LBxgMuL9CWWDEULg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only:
2426
- main
2527
before_build:
28+
- ps: $env:KEY_SNK_B64 | Set-Content -Path "key.snk.b64"
29+
- certutil -decode key.snk.b64 key.snk
2630
- dotnet restore csharp -s https://api.nuget.org/v3/index.json
2731
- ps: Compress-Archive -Path "resources\geocoding\*" -DestinationPath "resources\geocoding.zip"
2832
- ps: Compress-Archive -Path "resources\test\geocoding\*" -DestinationPath "resources\test\testgeocoding.zip"

csharp/PhoneNumbers.Extensions.Test/PhoneNumbers.Extensions.Test.csproj

+6
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,12 @@
1010
<IsPackable>false</IsPackable>
1111
</PropertyGroup>
1212

13+
<PropertyGroup Condition="'$(APPVEYOR_PULL_REQUEST_NUMBER)' == ''">
14+
<SignAssembly>true</SignAssembly>
15+
<AssemblyOriginatorKeyFile>../../key.snk</AssemblyOriginatorKeyFile>
16+
<PublicSign>true</PublicSign>
17+
</PropertyGroup>
18+
1319
<PropertyGroup Condition="'$(TargetFramework)' == 'net8.0' Or '$(TargetFramework)' == 'net9.0'">
1420
<Nullable>enable</Nullable>
1521
</PropertyGroup>

csharp/PhoneNumbers.Extensions/PhoneNumbers.Extensions.csproj

+6
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,12 @@
2727
<AnalysisLevel>5</AnalysisLevel>
2828
</PropertyGroup>
2929

30+
<PropertyGroup Condition="'$(APPVEYOR_PULL_REQUEST_NUMBER)' == ''">
31+
<SignAssembly>true</SignAssembly>
32+
<AssemblyOriginatorKeyFile>../../key.snk</AssemblyOriginatorKeyFile>
33+
<PublicSign>true</PublicSign>
34+
</PropertyGroup>
35+
3036
<ItemGroup>
3137
<None Include="..\..\icon.png" Pack="true" PackagePath="" />
3238
</ItemGroup>

csharp/PhoneNumbers.Test/PhoneNumbers.Test.csproj

+6
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,12 @@
99
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
1010
</PropertyGroup>
1111

12+
<PropertyGroup Condition="'$(APPVEYOR_PULL_REQUEST_NUMBER)' == ''">
13+
<SignAssembly>true</SignAssembly>
14+
<AssemblyOriginatorKeyFile>../../key.snk</AssemblyOriginatorKeyFile>
15+
<PublicSign>true</PublicSign>
16+
</PropertyGroup>
17+
1218
<PropertyGroup Condition="'$(TargetFramework)' == 'net8.0' Or '$(TargetFramework)' == 'net9.0'">
1319
<Nullable>enable</Nullable>
1420
</PropertyGroup>

csharp/PhoneNumbers/PhoneNumbers.csproj

+7
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,13 @@
2929
<Nullable>enable</Nullable>
3030
</PropertyGroup>
3131

32+
<PropertyGroup Condition="'$(APPVEYOR_PULL_REQUEST_NUMBER)' == ''">
33+
<SignAssembly>true</SignAssembly>
34+
<AssemblyOriginatorKeyFile>../../key.snk</AssemblyOriginatorKeyFile>
35+
<PublicSign>true</PublicSign>
36+
<DefineConstants>$(DefineConstants);SIGNED</DefineConstants>
37+
</PropertyGroup>
38+
3239
<ItemGroup>
3340
<EmbeddedResource Include="..\..\resources\*.xml" Exclude="..\..\resources\PhoneNumberMetadataForTesting.xml" />
3441
<EmbeddedResource Include="..\..\resources\timezones\map_data.txt" LinkBase="timezones" />

csharp/PhoneNumbers/Util.cs

+4
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,11 @@
1919
using System.Collections.Generic;
2020
using System.Runtime.CompilerServices;
2121

22+
#if !SIGNED
2223
[assembly: InternalsVisibleTo("PhoneNumbers.Test")]
24+
#else
25+
[assembly: InternalsVisibleTo("PhoneNumbers.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100bd3070027f51a9975cac34376755e3629985626c0ccbb41bb057f7d06dd6940dafb35ed0358fd96f24525cde3229cecc6fc9eb3bf582ecb6cf3a837f422d38fe2f5d2d7d0b75a5fe9120c77d3a0d25b9b60060cd715146920d675b6f639bcf9845bcf0f42070caca24be55143958dcc4eaa7e4e2941ecf2fab4ba479aaee8dc2")]
26+
#endif
2327

2428
namespace PhoneNumbers
2529
{

0 commit comments

Comments
 (0)