2/23/2005

Boris - you got PLAN?

"Beh-heh! Of course I got PLAN! Dey don't ever vork, but I got one!"

Well, Boris, how about this: You want to deploy a .NET usercontrol app for which you have created a COM Callable wrapper (Register for COM Interop) and you want to deploy it via a web page in Internet Explorer with the typical CAB file codebase setup and an INF file in the CAB that says what to do.

Easy, right?


NOPE! Dig this from HOW TO (Q311297):

Components That Are Required by the COM Interop Program
  • The client computer must have the Microsoft .NET runtime installed before you deploy the COM Interop assembly.

  • Developers must deploy all .NET assemblies that are included in the program.

  • Developers must deploy all Interop assemblies that represent distinct COM that are included in the program.All COM components must be deployed and registered on the client computer.


Limitations of .NET Components Deployment
  • Developers cannot install assemblies from the Web directly into the Global Assembly Cache (GAC).

  • You cannot use the OBJECT element to start any already downloaded Windows Forms controls from the GAC.

  • You cannot deploy .NET assembly and COM component in the same .cab file.

  • A single .cab file can only contain one .NET assembly.


In short, about the only sensible solution to this is to refactor your solution so that all classes and namespaces are in a SINGLE ASSEMBLY!

The reason I bring this all up is because Morgan Skinner invented a very nice way of making a .NET UserControl fool the Registry into thinking its an ActiveX control:
-- unfortunately, because of the Internet Explorer partially trusted code sandbox, and the above nasty discoveries, it just about knocks that one in the head!

There are additional issue for developers to think about as well: When a normal call is made into unmanaged code from managed .NET code, a stack walk of all assemblies is performed to make sure that all of them have permission to make calls into unmanaged code. If you have an assembly that's been downloaded from the Internet, it is not going to have such permissions by default. And, I know of no way that you can give it such permissions.

Unmanaged code aside, you will need another MSI Installer (hey, its just the 23rd CAB file and OBJECT tag - what's the big deal!) that will set Full Trust on all your dependent assemblies, based on their being signed with a strong name. Otherwise, you'll have an ActiveX control, but it will be quadriplegic.

I read it, and I wept.

Boris! Don't vorry, Dollink! Vee don't need no steenking "Dot Net"! Squirrel and Moose can do dees weeth VeeBee 6, for only $12 hour! Plus, no benefits!

Gimme a break, guys.