proper way to sign .net core assembly
Asked Answered
T

1

10

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 ?

Trigonous answered 18/7, 2016 at 11:4 Comment(3)
That looks correct. Are you experiencing any issues with your signed assembly?Druce
no issues yet, I haven't found an official doc on how to do this, and there's no signing tab in VS with .net core, so I had to guess/google a bitTrigonous
just want to mention that, now dotnet core dosen't recommend strong names your assemblies. linkDivestiture
P
6

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.

Plumber answered 20/7, 2016 at 8:6 Comment(1)
how the validation works when .net core app is running on Linux box?Reshape

© 2022 - 2024 — McMap. All rights reserved.