Skip to content

Signed assemblies are delay signed by default #14957

@bslatner

Description

@bslatner

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.

  1. Create a blank solution
  2. Add an F# .NET 4.8 class library to it
  3. Generate a key using sn.exe -k key.snk
  4. Update the project settings to sign the assembly using that key.
  5. Build
  6. Go to bin directory and type sn.exe -v mylibrary.dll
  7. Receive error message: Failed to verify assembly -- Strong name validation failed.
  8. Verify that the assembly has been delay-signed. sn.exe -Tp mylibrary.dll will show the public key.
  9. Complete the signature: sn.exe -R mylibrary.dll key.snk
  10. 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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status

    Done

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions