Monday, October 10, 2016

Getting the Strong Name PublicKeyTolken from an Assembly

[Update, if this doesn't work check the bottom]

Ok, this is .net 101, but I don't update assemblies that often so here is a recap of it so I remember in the future more for me than for you.

1) First, go the the assembly, right click it, get the details, write down the version number, that is probably old too.

2) Since you have the file open, copy it's path, then open up a Visual Studio command prompt.  Type in

sn -T (paste your path)\yourassemblydll

And it should output a new/correct PublicKeyTolken.

Copy and paste the new version and the new PublicKeyTolken text into your config file.  That should do it.

More info on this [HERE].


Well, this used to work all fine and good, but didn't work on a new machine that I have that just had visual Studio 2015 on it.  Here is what I had to do.

1) Navigate with file explorer to where the sn.exe file is located, for me it was here-
C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.6.1 Tools.  Copy that that path then open the Visual Studio developer prompt.

2) type cd then past the path in, hit enter.

3) Next, get the path to your dll that you want to get a strong name for.  Also write down the detail information like in step 1 in the old way above.

4) In the command prompt type sn.exe -T and hit enter.

That worked for me.

No comments: