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 :)