Skip to content

Strong name signing fails with the PublicSign option #11546

Closed
@robertpi

Description

@robertpi

Using the MSBuild property 'PublicSign' causes strong name signing to fail and breaks the build.

Repro steps

Create a new F# project:

dotnet new classlib --language F#

Create a new strong named key:

sn -k sgKey.snk

Add the following property group to the fsproj file:

  <PropertyGroup>
    <SignAssembly>true</SignAssembly>
    <AssemblyOriginatorKeyFile>sgKey.snk</AssemblyOriginatorKeyFile>
    <PublicSign>true</PublicSign>
    <DelaySign>false</DelaySign>
  </PropertyGroup>

Build and you'll see the following output:

c:\code\fsharp-publicsign-repo
>dotnet build
Microsoft (R) Build Engine version 16.9.0+57a23d249 for .NET
Copyright (C) Microsoft Corporation. All rights reserved.

  Determining projects to restore...
  All projects are up-to-date for restore.
FSC : error FS2014: A problem occurred writing the binary 'c:\code\fsharp-publicsign-repo\obj\Debug\net5.0\fsharp-publicsign-repo.dll': A call to StrongNameSignatureSize failed (Invalid Public Key blob) [c:\code\fsharp-publicsign-repo\fsharp-publicsign-repo.fsproj]

Build FAILED.

FSC : error FS2014: A problem occurred writing the binary 'c:\code\fsharp-publicsign-repo\obj\Debug\net5.0\fsharp-publicsign-repo.dll': A call to StrongNameSignatureSize failed (Invalid Public Key blob) [c:\code\fsharp-publicsign-repo\fsharp-publicsign-repo.fsproj]
    0 Warning(s)
    1 Error(s)

Time Elapsed 00:00:02.32

Same method works fine without PublicSign option.

Related information

  • Operating system

Tested on:

Ubuntu 18.04 LTS

Edition Windows 10 Pro
Version 20H2
OS build 19042.928

  • .NET Core 5.0.202

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugImpact-Medium(Internal MS Team use only) Describes an issue with moderate impact on existing code.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions