Skip to content

Commit a635591

Browse files
committed
Enable NuGet lock file for reproducible builds (MINOR)
Enabled packages.lock.json for deterministic dependency resolution: Project Changes: - Added RestorePackagesWithLockFile=true to .csproj - Added RestoreLockedMode=true for CI environments - Generated initial packages.lock.json with all dependencies Lock File Contents: - Direct dependencies: Microsoft.Win32.Registry 5.0.0 - Transitive dependencies tracked: - System.Security.AccessControl 5.0.0 - System.Security.Principal.Windows 5.0.0 - Microsoft.NETCore.Platforms 5.0.0 - Includes content hashes for security verification Workflow Changes: - Re-enabled setup-dotnet built-in cache - Now uses packages.lock.json for cache key - Both build and release jobs benefit from caching Benefits: ✅ Reproducible builds - Exact dependency versions locked ✅ Security - Content hashes prevent tampering ✅ Faster CI - Better caching with lock file ✅ Dependency tracking - All transitive deps visible ✅ Supply chain protection - Prevents dependency confusion Locked Mode in CI: - RestoreLockedMode ensures CI uses exact locked versions - Prevents unexpected dependency updates in builds - Fails if lock file is out of sync (forces explicit updates)
1 parent 9068376 commit a635591

3 files changed

Lines changed: 76 additions & 0 deletions

File tree

.github/workflows/build-release.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@ jobs:
6060
uses: actions/setup-dotnet@v4
6161
with:
6262
dotnet-version: '8.0.x'
63+
cache: true
64+
cache-dependency-path: '**/packages.lock.json'
6365

6466
- name: Cache NuGet packages
6567
uses: actions/cache@v4
@@ -151,6 +153,8 @@ jobs:
151153
uses: actions/setup-dotnet@v4
152154
with:
153155
dotnet-version: '8.0.x'
156+
cache: true
157+
cache-dependency-path: '**/packages.lock.json'
154158

155159
- name: Cache NuGet packages
156160
uses: actions/cache@v4

ContextMenuEditor.csproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@
2222
<PublishSingleFile>true</PublishSingleFile>
2323
<PublishTrimmed>false</PublishTrimmed>
2424
<IncludeNativeLibrariesForSelfExtract>true</IncludeNativeLibrariesForSelfExtract>
25+
26+
<!-- Enable NuGet lock file for reproducible builds -->
27+
<RestorePackagesWithLockFile>true</RestorePackagesWithLockFile>
28+
<RestoreLockedMode Condition="'$(CI)' == 'true'">true</RestoreLockedMode>
2529
</PropertyGroup>
2630

2731
<ItemGroup>

packages.lock.json

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
{
2+
"version": 1,
3+
"dependencies": {
4+
"net8.0-windows7.0": {
5+
"Microsoft.NET.ILLink.Tasks": {
6+
"type": "Direct",
7+
"requested": "[8.0.20, )",
8+
"resolved": "8.0.20",
9+
"contentHash": "Rhcto2AjGvTO62+/VTmBpumBOmqIGp7nYEbTbmEXkCq4yPGxV8whju3/HsIA/bKyo2+DggaYk5+/8sxb1AbPTw=="
10+
},
11+
"Microsoft.Win32.Registry": {
12+
"type": "Direct",
13+
"requested": "[5.0.0, )",
14+
"resolved": "5.0.0",
15+
"contentHash": "dDoKi0PnDz31yAyETfRntsLArTlVAVzUzCIvvEDsDsucrl33Dl8pIJG06ePTJTI3tGpeyHS9Cq7Foc/s4EeKcg==",
16+
"dependencies": {
17+
"System.Security.AccessControl": "5.0.0",
18+
"System.Security.Principal.Windows": "5.0.0"
19+
}
20+
},
21+
"Microsoft.NETCore.Platforms": {
22+
"type": "Transitive",
23+
"resolved": "5.0.0",
24+
"contentHash": "VyPlqzH2wavqquTcYpkIIAQ6WdenuKoFN0BdYBbCWsclXacSOHNQn66Gt4z5NBqEYW0FAPm5rlvki9ZiCij5xQ=="
25+
},
26+
"System.Security.AccessControl": {
27+
"type": "Transitive",
28+
"resolved": "5.0.0",
29+
"contentHash": "dagJ1mHZO3Ani8GH0PHpPEe/oYO+rVdbQjvjJkBRNQkX4t0r1iaeGn8+/ybkSLEan3/slM0t59SVdHzuHf2jmw==",
30+
"dependencies": {
31+
"Microsoft.NETCore.Platforms": "5.0.0",
32+
"System.Security.Principal.Windows": "5.0.0"
33+
}
34+
},
35+
"System.Security.Principal.Windows": {
36+
"type": "Transitive",
37+
"resolved": "5.0.0",
38+
"contentHash": "t0MGLukB5WAVU9bO3MGzvlGnyJPgUlcwerXn1kzBRjwLKixT96XV0Uza41W49gVd8zEMFu9vQEFlv0IOrytICA=="
39+
}
40+
},
41+
"net8.0-windows7.0/win-x64": {
42+
"Microsoft.Win32.Registry": {
43+
"type": "Direct",
44+
"requested": "[5.0.0, )",
45+
"resolved": "5.0.0",
46+
"contentHash": "dDoKi0PnDz31yAyETfRntsLArTlVAVzUzCIvvEDsDsucrl33Dl8pIJG06ePTJTI3tGpeyHS9Cq7Foc/s4EeKcg==",
47+
"dependencies": {
48+
"System.Security.AccessControl": "5.0.0",
49+
"System.Security.Principal.Windows": "5.0.0"
50+
}
51+
},
52+
"System.Security.AccessControl": {
53+
"type": "Transitive",
54+
"resolved": "5.0.0",
55+
"contentHash": "dagJ1mHZO3Ani8GH0PHpPEe/oYO+rVdbQjvjJkBRNQkX4t0r1iaeGn8+/ybkSLEan3/slM0t59SVdHzuHf2jmw==",
56+
"dependencies": {
57+
"Microsoft.NETCore.Platforms": "5.0.0",
58+
"System.Security.Principal.Windows": "5.0.0"
59+
}
60+
},
61+
"System.Security.Principal.Windows": {
62+
"type": "Transitive",
63+
"resolved": "5.0.0",
64+
"contentHash": "t0MGLukB5WAVU9bO3MGzvlGnyJPgUlcwerXn1kzBRjwLKixT96XV0Uza41W49gVd8zEMFu9vQEFlv0IOrytICA=="
65+
}
66+
}
67+
}
68+
}

0 commit comments

Comments
 (0)