Okay, somebody hands me a signed .NET assembly. What's the easiest way to
get its strong name WITHOUT writing a program to do it? I'm wondering if
there is a tool that will print out the strong name or something similar. I
was hoping I could get the strong name by right-clicking on the file and
searching through its properties, but no luck...

Re: Easiest way to get Strong Name? by Michael

Michael
Sun Apr 16 12:09:53 CDT 2006

Hello William,

SN.EXE from the c:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\Bin\ ?

WS> Okay, somebody hands me a signed .NET assembly. What's the easiest
WS> way to get its strong name WITHOUT writing a program to do it? I'm
WS> wondering if there is a tool that will print out the strong name or
WS> something similar. I was hoping I could get the strong name by
WS> right-clicking on the file and searching through its properties, but
WS> no luck...
WS>
---
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsch



Re: Easiest way to get Strong Name? by Cerebrus

Cerebrus
Sun Apr 16 23:25:42 CDT 2006

Hi William,

The Strong name tool (sn.exe), which can be invoked directly from the
VS.NET command prompt, gives you all the information related to strong
names.

> sn.exe -v "MyAssembly.dll"
will tell you if an assembly is strong named or not.

> sn.exe -Tp "MyAssembly.dll"
will output both the full Public Key (a v. long string) and the much
shorter Public Key token.

> sn.exe -T "MyAssembly.dll"
will output only the Public Key token.

> sn.exe -tp "MyKey.snk"
is run on the KeyFile and will also provide the same output. Note the
small -tp switch.

HTH,

Regards,

Cerebrus.


Re: Easiest way to get Strong Name? by WilliamSullivan

WilliamSullivan
Mon Apr 17 07:42:02 CDT 2006

See... that's just it. No strong name. Just PARTS of the strong name. I'm
looking for an easy way to get the strong name of an assembly... As in,
"AssemblyName, Version=0.0.0.0, Culture=Neutral,
PublicKeyToken=1111111111111111". What SN gives you is bread crumbs that you
have to press together to make a retarded loaf. Chance of errors when doing
this? What do you think? I'm wondering if there is a tool already out there
that, when you hand it an assembly, hands you back the ENTIRE strong name.
Maybe even pastes it into the clipboard, I don't know... At a minimum it
would give you back, get this, not the PKT, not the version, not the culture,
but the whole shebang WHAM! Right there! Look, its the strong name of the
assembly! I can just copy the whole thing and paste it right into my
program, without any worries that I screwed up adding little pieces from this
place and that together...

"Cerebrus" wrote:

> Hi William,
>
> The Strong name tool (sn.exe), which can be invoked directly from the
> VS.NET command prompt, gives you all the information related to strong
> names.
>
> > sn.exe -v "MyAssembly.dll"
> will tell you if an assembly is strong named or not.
>
> > sn.exe -Tp "MyAssembly.dll"
> will output both the full Public Key (a v. long string) and the much
> shorter Public Key token.
>
> > sn.exe -T "MyAssembly.dll"
> will output only the Public Key token.
>
> > sn.exe -tp "MyKey.snk"
> is run on the KeyFile and will also provide the same output. Note the
> small -tp switch.
>
> HTH,
>
> Regards,
>
> Cerebrus.
>
>

Re: Easiest way to get Strong Name? by Nicole

Nicole
Tue Apr 18 09:52:22 CDT 2006

There's no such beastie in the SDK, although secutil.exe probably comes
closer to your needs than sn.exe, although it provides the full signing key
rather than the token that you would prefer. That said, it's really quite
trivial to write a little app to do this. e.g. (console app):

using System;
using System.Reflection;
using System.Windows.Forms;

namespace StrongNameReader
{
internal sealed class Program
{
[STAThread]
private static void Main(string[] args)
{
try
{
if (args.Length == 1)
{
string assemblyName =
Assembly.ReflectionOnlyLoadFrom(args[0]).FullName;
Clipboard.SetText(assemblyName);
Console.WriteLine(assemblyName);
}
else
{
if (args.Length == 0)
{
throw new ArgumentException("Please provide an assembly path");
}
else
{
throw new ArgumentException("Please provide one assembly path only.");
}
}
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
}
}
}



"William Sullivan" <WilliamSullivan@discussions.microsoft.com> wrote in
message news:9C1201A0-CBAF-4C1A-9482-45974AF8A087@microsoft.com...
> See... that's just it. No strong name. Just PARTS of the strong name.
> I'm
> looking for an easy way to get the strong name of an assembly... As in,
> "AssemblyName, Version=0.0.0.0, Culture=Neutral,
> PublicKeyToken=1111111111111111". What SN gives you is bread crumbs that
> you
> have to press together to make a retarded loaf. Chance of errors when
> doing
> this? What do you think? I'm wondering if there is a tool already out
> there
> that, when you hand it an assembly, hands you back the ENTIRE strong name.
> Maybe even pastes it into the clipboard, I don't know... At a minimum it
> would give you back, get this, not the PKT, not the version, not the
> culture,
> but the whole shebang WHAM! Right there! Look, its the strong name of
> the
> assembly! I can just copy the whole thing and paste it right into my
> program, without any worries that I screwed up adding little pieces from
> this
> place and that together...
>
> "Cerebrus" wrote:
>
>> Hi William,
>>
>> The Strong name tool (sn.exe), which can be invoked directly from the
>> VS.NET command prompt, gives you all the information related to strong
>> names.
>>
>> > sn.exe -v "MyAssembly.dll"
>> will tell you if an assembly is strong named or not.
>>
>> > sn.exe -Tp "MyAssembly.dll"
>> will output both the full Public Key (a v. long string) and the much
>> shorter Public Key token.
>>
>> > sn.exe -T "MyAssembly.dll"
>> will output only the Public Key token.
>>
>> > sn.exe -tp "MyKey.snk"
>> is run on the KeyFile and will also provide the same output. Note the
>> small -tp switch.
>>
>> HTH,
>>
>> Regards,
>>
>> Cerebrus.
>>
>>


Re: Easiest way to get Strong Name? by WilliamSullivan

WilliamSullivan
Tue Apr 18 15:36:29 CDT 2006

True, true. And that's what I did. Thanks.

"Nicole Calinoiu" wrote:

> There's no such beastie in the SDK, although secutil.exe probably comes
> closer to your needs than sn.exe, although it provides the full signing key
> rather than the token that you would prefer. That said, it's really quite
> trivial to write a little app to do this. e.g. (console app):
>
> using System;
> using System.Reflection;
> using System.Windows.Forms;
>
> namespace StrongNameReader
> {
> internal sealed class Program
> {
> [STAThread]
> private static void Main(string[] args)
> {
> try
> {
> if (args.Length == 1)
> {
> string assemblyName =
> Assembly.ReflectionOnlyLoadFrom(args[0]).FullName;
> Clipboard.SetText(assemblyName);
> Console.WriteLine(assemblyName);
> }
> else
> {
> if (args.Length == 0)
> {
> throw new ArgumentException("Please provide an assembly path");
> }
> else
> {
> throw new ArgumentException("Please provide one assembly path only.");
> }
> }
> }
> catch (Exception ex)
> {
> Console.WriteLine(ex.Message);
> }
> }
> }
> }
>
>
>
> "William Sullivan" <WilliamSullivan@discussions.microsoft.com> wrote in
> message news:9C1201A0-CBAF-4C1A-9482-45974AF8A087@microsoft.com...
> > See... that's just it. No strong name. Just PARTS of the strong name.
> > I'm
> > looking for an easy way to get the strong name of an assembly... As in,
> > "AssemblyName, Version=0.0.0.0, Culture=Neutral,
> > PublicKeyToken=1111111111111111". What SN gives you is bread crumbs that
> > you
> > have to press together to make a retarded loaf. Chance of errors when
> > doing
> > this? What do you think? I'm wondering if there is a tool already out
> > there
> > that, when you hand it an assembly, hands you back the ENTIRE strong name.
> > Maybe even pastes it into the clipboard, I don't know... At a minimum it
> > would give you back, get this, not the PKT, not the version, not the
> > culture,
> > but the whole shebang WHAM! Right there! Look, its the strong name of
> > the
> > assembly! I can just copy the whole thing and paste it right into my
> > program, without any worries that I screwed up adding little pieces from
> > this
> > place and that together...
> >
> > "Cerebrus" wrote:
> >
> >> Hi William,
> >>
> >> The Strong name tool (sn.exe), which can be invoked directly from the
> >> VS.NET command prompt, gives you all the information related to strong
> >> names.
> >>
> >> > sn.exe -v "MyAssembly.dll"
> >> will tell you if an assembly is strong named or not.
> >>
> >> > sn.exe -Tp "MyAssembly.dll"
> >> will output both the full Public Key (a v. long string) and the much
> >> shorter Public Key token.
> >>
> >> > sn.exe -T "MyAssembly.dll"
> >> will output only the Public Key token.
> >>
> >> > sn.exe -tp "MyKey.snk"
> >> is run on the KeyFile and will also provide the same output. Note the
> >> small -tp switch.
> >>
> >> HTH,
> >>
> >> Regards,
> >>
> >> Cerebrus.
> >>
> >>
>
>