Welcome to CrankyGoblin.Com Sign in | Join | Help

Public Class GeoffAppleby

Inherits Microsoft.VisualBasic.MVP : Implements IBrainFart
The joys of Interop

So i'm working on an IE extension. Which means i have have to deal with COM issues.

'This isn't too bad', I thought to myself, 'I've done this before'.

And it's not too bad. The issues I have is that I'm going to have to install a dll in the GAC. I've never done this before. So I research assembly signing, and sort that out. I make myself a string name keyfile using sn.exe, and it looks good. I attach that to my dll with the [assemblykeyfile] attribute. I try to recompile.

So now i discover that to compile an assembly with a strong name, every reference you make to other assemblies must also be compiled with a strong name.

OK, this is fine, except for one. I make a reference to shdocvw.dll, which is COM, so it autogenerates the Interop for me, as VS does. But it doesn't seem to give me an option to strong name it. WTF? I do lots and lots of research, and for once, Google wasn't my friend. All reports i could find say that you can't get visual studio to attach a string name to interop libraries.

So i do it the long way (for reference, calling 'tlbimp.exe C:\windows\system32\shdocvw.dll \keyfile:c:\mykeyfile.snk' appeared to work well). Later, i'm playing with the properties of my project, and see a property called 'Wrapper assembly key file'. What's this? No idea. But i put in the path to my snk file, and redo the interop from vs. The interop dll was strong named.

Well bugger me :)

This actually leads me to a question, which if any of you know the answer, please let me know :) If i plan to release a dll to client machines, and this dll needs to be installed in the GAC, and this dll has a dendency on an interop dll, does the interop dll get installed in the GAC too? And if so, what if it exists with a different strong name? Anyone know? I have no idea abou the GAC, it seems.

Listening to: no one knows - queens of the stone age - (4:38)

Edit: Well that's just great. For once i'm actually impressed at C#. Specifying the key file for the interop seems to be an option you can do in C# projects, and not VB.net ones (i can't find it in the vb project properties anyway). Bugger.

Edit the second: I pretty much have all my registration and GAC issues sorted out now. The interop dll does need to be installed in the GAC too. Simple :)

Posted: Thursday, August 12, 2004 12:30 PM by Geoff Appleby

Comments

Jason Salas' WebLog said:

# August 14, 2004 9:43 AM
Leave a Comment

(required) 

(required) 

(optional)

(required) 

To submit your comment, click on these pictures:
  • Geoff the big mouth
  • Happy Geoff
  • Angry Geoff
Gaptcha Image - No Peeking! Gaptcha Image - No Peeking! Gaptcha Image - No Peeking!
Gaptcha Image - No Peeking! Gaptcha Image - No Peeking! Gaptcha Image - No Peeking!
Gaptcha Image - No Peeking! Gaptcha Image - No Peeking! Gaptcha Image - No Peeking!
Can't recognise the people in these pictures? Look here for a quick introduction.
There's a time limit for you to get your comment submitted before this set of pictures expires. If you think it's been longer than 10 minutes, get some new pictures first (you won't lose what you've typed so far).
Get some new pictures 

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS