Skip to content

Fix sn.exe not found in PATH during strong name signing#4923

Merged
pepone merged 2 commits into
3.7from
jose/fix-sn-path
Jan 22, 2026
Merged

Fix sn.exe not found in PATH during strong name signing#4923
pepone merged 2 commits into
3.7from
jose/fix-sn-path

Conversation

@pepone

@pepone pepone commented Jan 22, 2026

Copy link
Copy Markdown
Member

Summary

  • Fix strong name signing failure when building .NET packages with dotnet msbuild
  • The sn.exe tool is not in PATH by default on GitHub Actions Windows runners
  • Added logic to locate sn.exe in Windows SDK directories (NETFX 4.8.2, 4.8.1, 4.8)

Test plan

🤖 Generated with Claude Code

Copilot AI review requested due to automatic review settings January 22, 2026 09:45

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a build failure when using dotnet msbuild on Windows by locating the sn.exe tool needed for strong name signing. The issue occurs because sn.exe is not in the PATH by default on GitHub Actions Windows runners, and the NetFxToolsDirectory property is not set when using dotnet msbuild.

Changes:

  • Added fallback logic to locate sn.exe across multiple Windows SDK installation paths
  • Added validation to fail fast with a helpful error message if sn.exe cannot be found
  • Updated the signing command to use the discovered sn.exe path instead of relying on PATH

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@pepone
pepone requested a review from externl January 22, 2026 09:49
Comment thread csharp/msbuild/ice.sign.targets Outdated
<AssemblyOriginatorKeyFile Condition="'$(PUBLIC_KEYFILE)' == ''">$(KEYFILE)</AssemblyOriginatorKeyFile>
</PropertyGroup>

<!-- Locate sn.exe in Windows SDK. NetFxToolsDirectory is not set when using dotnet msbuild. -->

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we just ensure this is set in CI instead? Hardcoding various paths here seems brittle.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe use it from PATH, and update CI to add the correct directory to PATH?

Add the .NET Framework SDK tools directory to PATH in the build-dotnet-packages
workflow to ensure sn.exe is available for strong name signing.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@pepone
pepone merged commit 4224a41 into 3.7 Jan 22, 2026
41 checks passed
@pepone
pepone deleted the jose/fix-sn-path branch January 26, 2026 20:13
This was referenced Jan 27, 2026
@externl externl mentioned this pull request Mar 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants