Please provide a succinct description of the issue.
Starting in VS 17.5.3 (possibly 17.5.2) my project that includes strongly-named F# assemblies (.NET 4.8) will not run. On startup, an exception is thrown indicating that the strong name on my F# assembly cannot be validated. This does not happen on C# assemblies.
The exact message from my ASP.NET yellow screen of death is:
FileLoadException: Could not load file or assembly 'xxxx' or one of its dependencies. Strong name signature could not be verified. The assembly may have been tampered with, or it was delay signed but not fully signed with the correct private key. (Exception from HRESULT: 0x80131045)]
The issue occurs whether you build with VS or with msbuild.exe.
Provide the steps required to reproduce the problem:
I was able to reproduce this problem very easily.
- Create a blank solution
- Add an F# .NET 4.8 class library to it
- Generate a key using
sn.exe -k key.snk
- Update the project settings to sign the assembly using that key.
- Build
- Go to bin directory and type
sn.exe -v mylibrary.dll
- Receive error message:
Failed to verify assembly -- Strong name validation failed.
- Verify that the assembly has been delay-signed.
sn.exe -Tp mylibrary.dll will show the public key.
- Complete the signature:
sn.exe -R mylibrary.dll key.snk
- Try
sn.exe -v mylibrary.dll again. It validates successfully.
I am attaching a zip file with an example project that demonstrates the issue. SignatureTest.zip
Expected behavior
The assembly should be fully signed unless the DelaySign attribute is set to True. It has been this way for years.
Actual behavior
The assembly is delay-signed.
Known workarounds
Use sn.exe -R to complete the signature after build.
Related information
- Operating system: Windows 11
- .NET 4.8
- Visual Studio 17.5.3
Please provide a succinct description of the issue.
Starting in VS 17.5.3 (possibly 17.5.2) my project that includes strongly-named F# assemblies (.NET 4.8) will not run. On startup, an exception is thrown indicating that the strong name on my F# assembly cannot be validated. This does not happen on C# assemblies.
The exact message from my ASP.NET yellow screen of death is:
FileLoadException: Could not load file or assembly 'xxxx' or one of its dependencies. Strong name signature could not be verified. The assembly may have been tampered with, or it was delay signed but not fully signed with the correct private key. (Exception from HRESULT: 0x80131045)]The issue occurs whether you build with VS or with
msbuild.exe.Provide the steps required to reproduce the problem:
I was able to reproduce this problem very easily.
sn.exe -k key.snksn.exe -v mylibrary.dllFailed to verify assembly -- Strong name validation failed.sn.exe -Tp mylibrary.dllwill show the public key.sn.exe -R mylibrary.dll key.snksn.exe -v mylibrary.dllagain. It validates successfully.I am attaching a zip file with an example project that demonstrates the issue. SignatureTest.zip
Expected behavior
The assembly should be fully signed unless the
DelaySignattribute is set toTrue. It has been this way for years.Actual behavior
The assembly is delay-signed.
Known workarounds
Use
sn.exe -Rto complete the signature after build.Related information