toptensoftware / markdowndeep

Open-source implementation of Markdown for C# and Javascript
268 stars 120 forks source link

Strong-sign the library #9

Open eugbaranov opened 13 years ago

eugbaranov commented 13 years ago

Would be quite convenient to have strong-signed assembly in the NuGet repository because otherwise in order to use in another strongly-signed assembly one have to download the source code and sign the library himself.

gdoten commented 12 years ago

I'll second that. Here's the steps it just took in order to get a signed version of markdowndeep.ddl.

  1. Grab the sources from the repo.
  2. Go to the Properties of the MarkdownDeep project and on the Signing tab check to sign the assembly and generate a new .snk file. I called mine MarkdownDeepKeyPair.snk.
  3. Open a command prompt that has the sn.exe tool in its path and navigate to the directory containing your new .snk file. Type these two commands:

sn -p MarkdownDeepKeyPair.snk MarkdownDeepKeyPair.pub sn -tp MarkdownDeepKeyPair.pub

  1. Edit the AssemblyInfo.cs file in the Properties directory of the MarkdownDeep project. Find the InternalsVisibleTo at the bottom of it and change it from:

[assembly: InternalsVisibleTo("MarkdownDeepTests")]

to this:

[assembly: InternalsVisibleTo(@"MarkdownDeepTests, PublicKey= 00240000048000009400000006020000002400005253413100040000010001006352de2eb5a8a9 6532c478f13f1af3f3e2ae8fab681859951ef1c512b1df8accd2134ef8ad55f623d8b8c0f1e1fe 89504bacdff8ce0253535f0a2f525c741a9e7af4db08b7ca81f3d060215d20f310b2216d186b61 da2734791c53d11e1ebb06357e97ee36747e7595dd233d06f591cb9dcc799bdcfc548b58fe0c4a 3ad28abd")]

Of course, copy and paste the public key shown in the your "sn -tp" command in step 3.

  1. Go the Properties pages of the MarkdownDeepTests project and specify that this project must also be signed with the same key.
  2. The solution now builds fine in the Debug config. The Release config was giving this error:

The command "if Release == Release NuGet.exe pack "G:\gd\markdowndeep\MarkdownDeep\MarkdownDeep.nuspec" -o "G:\gd\markdowndeep\Output"" exited with code 9009. MarkdownDeep The command "G:\gd\markdowndeep\MarkdownDeepJS\post_build.bat Release" exited with code 1. MarkdownDeepJS

This is because I didn't have nuget.exe in my path. Now I do and the Release config builds as well.

I'd be happy to check-in these changes to this repo if the devs would like.

gdoten commented 12 years ago

OK, well that didn't paste very well. Here's what I meant to paste into my previous comment...

I'll second that. Here's the steps it just took in order to get a signed version of markdowndeep.ddl.

  1. Grab the sources from the repo.
  2. Go to the Properties of the MarkdownDeep project and on the Signing tab check to sign the assembly and generate a new .snk file. I called mine MarkdownDeepKeyPair.snk.
  3. Open a command prompt that has the sn.exe tool in its path and navigate to the directory containing your new .snk file. Type these two commands:

sn -p MarkdownDeepKeyPair.snk MarkdownDeepKeyPair.pub sn -tp MarkdownDeepKeyPair.pub

  1. Edit the AssemblyInfo.cs file in the Properties directory of the MarkdownDeep project. Find the InternalsVisibleTo at the bottom of it and change it from:

[assembly: InternalsVisibleTo("MarkdownDeepTests")]

to this:

[assembly: InternalsVisibleTo(@"MarkdownDeepTests, PublicKey= 00240000048000009400000006020000002400005253413100040000010001006352de2eb5a8a9 6532c478f13f1af3f3e2ae8fab681859951ef1c512b1df8accd2134ef8ad55f623d8b8c0f1e1fe 89504bacdff8ce0253535f0a2f525c741a9e7af4db08b7ca81f3d060215d20f310b2216d186b61 da2734791c53d11e1ebb06357e97ee36747e7595dd233d06f591cb9dcc799bdcfc548b58fe0c4a 3ad28abd")]

Of course, copy and paste the public key shown in the your "sn -tp" command in step 3.

  1. Go the Properties pages of the MarkdownDeepTests project and specify that this project must also be signed with the same key.
  2. The solution now builds fine in the Debug config. The Release config was giving this error:

The command "if Release == Release NuGet.exe pack "G:\gd\markdowndeep\MarkdownDeep\MarkdownDeep.nuspec" -o "G:\gd\markdowndeep\Output"" exited with code 9009. MarkdownDeep The command "G:\gd\markdowndeep\MarkdownDeepJS\post_build.bat Release" exited with code 1. MarkdownDeepJS

This is because I didn't have nuget.exe in my path. Now I do and the Release config builds as well.

I'd be happy to check-in these changes to this repo if the devs would like.

gdoten commented 12 years ago

OK - this HTML editor is messing up what I'm entering. Close enough, I guess. (Learn to use the Preview button, Glenn.)

shiftkey commented 12 years ago

For reference, there's a nice long discussion on this over on the NuGet board about which approach to take: http://nuget.codeplex.com/discussions/247827/