Tonight I read a message thread where someone was having a problem getting a WiX DTF Managed Custom Action to display a MessageBox. Another developer quickly replied with the traditional `Managed Custom Actions are Evil` mantra:
Using C# is the problem. You have to use a native Win32 DLL for a custom action, not managed .NET code. This is an ongoing debate because more and more programmers are .NET-only (which is, but this is strictly my personal opinion, a very big problem, programmers have to know several languages, including C, C++ and Pascal and similar to call themselves programmers but I digress) and .NET does offer a nice, cosy environment to do things in. Still, this is not an arbitrary limitation, it has it reasons. See http://www.tramontana.co.hu/wix/lesson3.php#3.5 for a short description and a link to Rob's blog detailing the issue.
Wow. This is simply not true... the debate is dead.
Anyone with more then a passing interest in Windows Installer knows that three months ago MSFT/WiX/Rob/et al did a 180 degree, ABOUT-FACE!, flip/flop and started supporting managed code custom actions when they released Deployment Tools Foundation (DTF). Rob's blogged it, Justin's blogged it, I've blogged it repeatedly ( with tutorials ), InstallSite has covered it, it gets discussed in the WiX list, the Platform SDK newsgroup and even the InstallShield Community forum. You simply can not be a Wi/Wix/IS/Setup Expert and not know about DTF. Period!
The interesting part is that the person who made this comment also runs the Tramontana WiX tutorial site which is often cited by beginning WiX developers as `I'd never gotten it done without this tutorial!`.
A quick review of that tutorial shows that the topic on managed code custom actions is full of out dated information citing outdated references.
Another interesting observation in my mind is this developers bias in implying that real developers should be able to code Win32 DLL's in multiple languages such as C, C++, Basic (what version? VB6 couldn't natively export Win32), D, Eiffel and Pascal in order to claim that they are real programmers. All of this while eschewing the .NET framework.
Very interesting. Anyways, I'm not meaning to hurt anyones feelings. I just wanted to point out that you should be very careful what you read on the internet. This site excepted of course. :) ( Seriously, when I make mistakes, please leave a comment.)
Christopher, I had to laugh reading this, I cringe every time someone says exclusively "real programmers must [SOAP-BOX-PROPERTY]"!
ReplyDeleteMy only real beef with .Net is the same problem you have with it and that is the overhead of installing the .Net environment which is getting more and more expensive every year. For instance, lets say you have a 500MB app that is distributed on CD media. Your app requires .Net 3.1 or something like that. Oh, crap, it no longer fits on the media because you cannot count on the customer having Internet Access, so you must provide the complete setup.
I do agree that C# is a great programming language, however is there a way to use C# and statically link .net libraries to it? I think this is where C++ shines where you can create .dll custom actions that do not have any dependencies so you can be sure it will execute on all environments.
What do you think?
Hi Dan,
ReplyDeleteAnother interesting variation on this theme is where people imply that you can't possibly be a real setup developer if your using a GUI tool like InstallShield.
Anyways for your `statically link` question... not officially. There are some products out there ( Such as Xenocode Postbuild ) that allow you to use application virtualization to fake out the entire stack of dependencies.
I didn't fully understand this a couple years ago, but now I'm starting to believe more and more that many companies are just going to do away with all of this ugliness by virtualizing the entire application running environment. Think of it like Doctor Who's TARDIS ... a big application inside of a tiny blue box ( .exe ) that is then wrapped in the most basic of MSI's; WiX with Mondo.