Sunday, January 22, 2006

Why you should not use .NET for Windows and Explorer Extensions

Shocked? Well, there is a single good reason why you should refrain from using .NET assemblies to extend the Windows Explorer or other basic Windows components. With this entry I do not want to start a rant against .NET, far from it, I do love .NET, well ASP.NET anyway. But it is not a good choice for example for desk bands, even though creation of such explorer extensions just got easier with .NET.

Why, I hear you asking. Well, let's say you have a file context menu extension installed, which is based on MS .NET Framework 1.1. Windows Explorer, itself not being a .NET application, will automatically load the .NET 1.1 framework to get the extension up and running. Everything works fine. Every customer of yours, using this extension will be just as happy.

Now, they install the MS .NET Framework 2.0, great framework that is ;-) And they install for example Paint.NET, based on .NET 2.0, not a 1.1 version. It will run and it will work. Well, most parts anyway. But there are at least two very basic things that will not. The Open and Save dialogs. Do you already guess why? Well, in .NET 2.0, as well as other versions of .NET, they still encapsulate the normal Windows Explorer (non .NET based) dialog controls. Can you imagine what happens here? Your .NET 2.0 application will start the Windows Explorer internally, which in return will start your .NET 1.1 file extension dialog plug-in when the user right clicks any file... This is not supported by the .NET environment at all, and it is - by design - not supposed to work. Go figure ;-)

Now just imagine your .NET 1.1 control and a .NET 2.0 control from another supplier both want to integrate into the context menu of the Explorer. It will not work, ever. The whole explorer will be shut down by .NET saying it is not supported. Have fun ;-)

In short: .NET is a great environment, but before doing everything with .NET think about possible consequences coming your way.

This said, I am off and preparing my trip to Garmisch-Partenkirchen, where Daniel and Thomas will teach many more techniques on ASP.NET with Borland Developer Studio 2006. My Virtual Machine is all setup and ready. What a great week this will be... I'll blog about it, as Jason Vokes is bound to come you'll see some pictures, also.

For so long,
Daniel :)


Anonymous shekhar said...

Hi it was good information about .NET but i have basic question ..can I use both the .net framework on same machine e.g. v 1.x and 2.0 ? let me know I have read all ms docs but i am really not sure whether they work smoothly on same machine..

8:26 AM  
Blogger Daniel "sakura" Wischnewski said...

Hi Shekhar,

there is no problem running .NET 1.0, 1.1, 2.0 and future versions parallel. They wont even get into each other way. .NET is designed to work this way in fact.

9:16 PM  

Post a Comment

<< Home

Search WWW Search