@@ -24,91 +24,58 @@ jobs:
24
24
- name : Add local NuGet repository
25
25
run : dotnet nuget add source --username ${{ github.actor }} --password ${{ secrets.GITHUB_TOKEN }} --store-password-in-clear-text --name github "https://nuget.pkg.github.com/Yubico/index.json"
26
26
27
- - name : Build Yubico.Core
28
- run : dotnet build Yubico.NET.SDK.sln --configuration Debug
29
-
30
- - name : Disable Strong Name Verification
27
+ - name : Configure Strong Name Bypass (According to Microsoft Docs)
31
28
run : |
32
- # Find all Yubico assemblies and disable SN verification for all of them
33
- # First, find the sn.exe tool
34
- $snExe = $null
35
- $possiblePaths = @(
36
- "C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.7.2 Tools\x64\sn.exe",
37
- "C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.8 Tools\x64\sn.exe"
38
- )
39
-
40
- foreach ($path in $possiblePaths) {
41
- if (Test-Path $path) {
42
- $snExe = $path
43
- Write-Host "Found sn.exe at $snExe"
44
- break
45
- }
46
- }
47
-
48
- if ($null -eq $snExe) {
49
- Write-Host "sn.exe not found in common locations, will try using the PATH"
50
- $snExe = "sn.exe"
51
- }
52
-
53
- # Disable verification for all Yubico assemblies by their PublicKeyToken
54
- Write-Host "Disabling strong name verification for all assemblies"
55
- & $snExe -Vr *,fdb9ca4403bc032c
56
- & $snExe -Vr *
57
-
58
- # Also disable specific assemblies explicitly
59
- $assembliesToDisable = @(
60
- "Yubico.Core",
61
- "Yubico.YubiKey"
62
- )
29
+ # According to the docs, we need to ensure the bypass feature is ENABLED
30
+ # Create or update the registry key to enable strong name bypass (value 1)
31
+ Write-Host "Enabling strong name bypass feature according to official Microsoft documentation..."
63
32
64
- foreach ($assembly in $assembliesToDisable) {
65
- Write-Host "Disabling strong name verification for $assembly"
66
- & $snExe -Vr "$assembly,fdb9ca4403bc032c"
67
- }
33
+ # For 64-bit systems (GitHub runners are 64-bit)
34
+ New-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\.NETFramework" -Name "AllowStrongNameBypass" -Value 1 -PropertyType DWORD -Force
35
+ New-ItemProperty -Path "HKLM:\SOFTWARE\Wow6432Node\Microsoft\.NETFramework" -Name "AllowStrongNameBypass" -Value 1 -PropertyType DWORD -Force
68
36
69
- # Use the registry approach as well (belt and suspenders)
70
- $registryPaths = @(
71
- "HKLM:\SOFTWARE\Microsoft\StrongName\Verification",
72
- "HKLM:\SOFTWARE\Wow6432Node\Microsoft\StrongName\Verification"
73
- )
37
+ Write-Host "Registry keys set to ENABLE strong name bypass"
74
38
75
- foreach ($regPath in $registryPaths) {
76
- foreach ($assembly in $assembliesToDisable) {
77
- $keyPath = "$regPath\$assembly,fdb9ca4403bc032c"
78
- if (-not (Test-Path $keyPath)) {
79
- Write-Host "Creating registry key $keyPath"
80
- New-Item -Path $keyPath -Force | Out-Null
81
- }
82
- }
83
- }
84
-
85
- # Check if verification is disabled
86
- Write-Host "Checking verification settings:"
87
- & $snExe -Vl
39
+ # Also create application config file for the test assembly
40
+ $configPath = "Yubico.Core/tests/integration/app.config"
41
+ $configContent = @"
42
+ <?xml version="1.0" encoding="utf-8" ?>
43
+ <configuration>
44
+ <runtime>
45
+ <bypassTrustedAppStrongNames enabled="true" />
46
+ </runtime>
47
+ </configuration>
48
+ "@
49
+ Set-Content -Path $configPath -Value $configContent
50
+ Write-Host "Created app.config file to enable strong name bypass for the test project"
88
51
shell : pwsh
52
+
53
+ - name : Build Yubico.Core
54
+ run : dotnet build Yubico.NET.SDK.sln --configuration Debug
89
55
90
56
- name : Test Yubico.Core Integration Tests (NET47)
91
57
run : |
92
- # Set environment variables for this specific run
93
- $env:COMPLUS_DISABLESTRICTVERIFICATION=1
94
- $env:COMPLUS_DISABLESTRONGNAMEVERIFICATION=1
58
+ # Set the environment variable for the current process
59
+ $env:COMPLUS_EnableBypassTrustedAppStrongNames=1
95
60
96
- # Run the test with elevated permissions if possible
97
- dotnet test Yubico.Core/tests/integration/Yubico.Core.IntegrationTests.csproj -f net47 --logger trx --settings coverlet.runsettings.xml --collect:"XPlat Code Coverage"
61
+ # Run with explicit Debug configuration
62
+ dotnet test Yubico.Core/tests/integration/Yubico.Core.IntegrationTests.csproj -f net47 --configuration Debug -- logger trx --settings coverlet.runsettings.xml --collect:"XPlat Code Coverage"
98
63
shell : pwsh
99
-
64
+
100
65
- name : Test Yubico.YubiKey
101
66
run : dotnet test Yubico.YubiKey/tests/unit/Yubico.YubiKey.UnitTests.csproj --logger trx --settings coverlet.runsettings.xml --collect:"XPlat Code Coverage"
102
-
67
+
103
68
- name : Test Yubico.Core
104
69
run : dotnet test Yubico.Core/tests/unit/Yubico.Core.UnitTests.csproj --logger trx --settings coverlet.runsettings.xml --collect:"XPlat Code Coverage"
105
-
70
+
106
71
- name : Test Yubico.Core Integration tests (NET6)
107
72
run : dotnet test Yubico.Core/tests/integration/Yubico.Core.IntegrationTests.csproj -f net6.0 --logger trx --settings coverlet.runsettings.xml --collect:"XPlat Code Coverage"
108
-
73
+
109
74
- name : Test Yubico.Core Integration tests (NET8)
110
75
run : dotnet test Yubico.Core/tests/integration/Yubico.Core.IntegrationTests.csproj -f net8.0 --logger trx --settings coverlet.runsettings.xml --collect:"XPlat Code Coverage"
76
+
111
77
78
+
112
79
- name : Upload Test Result Files
113
80
uses : actions/upload-artifact@v4
114
81
with :
0 commit comments