Search code examples
c#.net.net-corestrongname

proper way to sign .net core assembly


I'm trying to sign a .net core lib, and I'm just not sure if I did everything correctly

1) using VS Command Promp I called sn -k mykey.snk

2) copied mykey.snk to myproject folder

3) in project.json added keyfile

"frameworks": {
    "netstandard1.6": {}
  },
  "buildOptions": {
    "outputName": "MyLib",
    "keyFile": "mykey.snk"
  }

is this correct, is the library (dll) going to be usable on both .net core and full .net 4.6 apps ?


Solution

  • Yes, this is the correct way. If you look into any ASP.NET Core projects, like Logging, you will find

    "buildOptions": {
       "keyFile": "../../tools/Key.snk"
       ...
    }
    

    in project.json file, and Key.snk in Tools folder. You also may check .NET Core - strong name assemblies issue.