How to Strong Name

D

Derek Martin

<Sigh> - okay, I have given up on the hashing idea, I guess I am going to
have to break down and figure the sn gooo out. I keep getting this message
when strong naming my assembly (an exe):

Unable to Emit Assembly: Referenced assembly 'Interop.Scripting' does not
have a strong name.

I get the error - that DLL that I am using isn't strong named, but how does
one strong name an exisitng file that I just imported? I did a search for
scripting.dll, hoping it would be about, but no luck.

Can someone assist so I can get this thing to a position where I can run a
fun command like this on it:

caspol -enterprise -addfulltrust appname.exe

???
Thanks,
Derek
 
P

Patrick Steele [MVP]

dmj2195 said:
I keep getting this message
when strong naming my assembly (an exe):

Unable to Emit Assembly: Referenced assembly 'Interop.Scripting' does not
have a strong name.

If you want to strong name an assembly, all referenced assemblies must
have strong names too. It's a .NET requirement.
I get the error - that DLL that I am using isn't strong named, but how does
one strong name an exisitng file that I just imported?

If you added a reference to a COM object in VS.NET, it automatically
generates an RCW (Runtime callable wrapper) using tlbimp. However, it
uses basic default options (no signing).

If you want your wrapper signed, you'll need to create the interop
assembly yourself from the command line:

tlbimp file.dll /out:Interop.file.dll /keyfile:mykey.snk
 
D

Derek Martin

Hi Patrick, I've tried that, and get this error:
TlbImp error: The input file 'C:\projects\bin\Interop.Scripting.dll' is not
a valid type library

?
 
P

Patrick Steele [MVP]

dmj2195 said:
Hi Patrick, I've tried that, and get this error:
TlbImp error: The input file 'C:\projects\bin\Interop.Scripting.dll' is not
a valid type library

You need to import the COM library. That looks like the already
converted DLL (the RCW). I think you're looking to import either
"msscript.ocx" or "scrrun.dll" from \WINNT\SYSTEM32.

tblimp C:\winnt\system32\scrrun.dll /out:interop.scripting.dll
/keyfile:mykey.snk
 
P

Patrick Steele [MVP]

dmj2195 said:
Okay, I see what you are getting at, however, I was able to import the
scrrun.dll file as interop.scripting, but it didn't appear to have the
member I am needing. I have attached what I have been using and perhaps you
can point me at the correct file (or perhaps I am importing it wrong).

What member are you needing? I was just guessing that scrrun.dll was
what you were importing based on the name "interop.scripting.dll".

The DLL attached is a .NET assembly, but it is not strong-named. If you
tell me a bit more about what you're doing I'll try and help you out.
 
D

Derek Martin

Thank you thank you thank you!
I got it to work after some finagling (sp?)...I forgot that it was a
namespace change on the import, so it wasn't recognizing simply:
scripting.member, I had to go and change those to Interop.Scripting.member -
wahoo!

THANK YOU SO MUCH! Now I can strong name, which, might let me run Network
Based programs :)

Thank you very, very much Patrick!

Derek
 
D

Derek Martin

Okay, if you are willing, I am not quite there yet. Now I am strong named,
I even did the sn -v and it said yippy on the strong name thing. Great, so
I move it into the Share and run this command:


caspol -enterprise -adduflltrust pathtoapp.exe

it says are you sure? I say yes, it says Success....great, but when I go to
run it...this error, STILL!!!!!!

System.Security.Permissions.SecurityPermission error...

Any ideas?
Thanks!


Derek Martin said:
Thank you thank you thank you!
I got it to work after some finagling (sp?)...I forgot that it was a
namespace change on the import, so it wasn't recognizing simply:
scripting.member, I had to go and change those to Interop.Scripting.member -
wahoo!

THANK YOU SO MUCH! Now I can strong name, which, might let me run Network
Based programs :)

Thank you very, very much Patrick!

Derek





perhaps
 
P

Patrick Steele [MVP]

dmj2195 said:
I move it into the Share and run this command:


caspol -enterprise -adduflltrust pathtoapp.exe

it says are you sure? I say yes, it says Success....great, but when I go to
run it...this error, STILL!!!!!!

System.Security.Permissions.SecurityPermission error...

I haven't worked much with the command-line caspol tool. I've only
briefly used the "Microsoft .NET Framework 1.1 Configuration" from
Administrative Tools.

In there, you could add a new code group based on the public-key you've
created for your application. Give that code FullTrust permission and
then make sure *no one* get's access to that key file you used to sign
the assembly. Otherwise, they could sign their own malicious code with
your ky and since you've given FullTrust to that key, the code could do
anything it wanted.
 
D

Derek Martin

Well, here is the problem - this is a deployment to about 250 machines,
running from the share (not locally) and we have to be able to stick
something into their login script (like a command) to add it to the allowed
instance...
???

Derek
 
P

Patrick Steele [MVP]

dmj2195 said:
Well, here is the problem - this is a deployment to about 250 machines,
running from the share (not locally) and we have to be able to stick
something into their login script (like a command) to add it to the allowed
instance...

Sorry Derek -- not my area of expertise. This might help:

".NET Framework Enterprise Security Policy Administration and
Deployment"
http://tinyurl.com/8qp3
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top