HREF EXEs are cool.

I have been, since I started using .NET, a big supporter of
the href="">‘Smart
Client’ or ‘Rich Client’ application. I’ve talked about it to people, I’ve
dug deep into the underlying technology, I’ve built samples… big fan
of the whole idea

. On a parallel track, I wrote several systems internal
to MSDN using VB.NET and Windows Forms, but I didn’t make any of them into
auto-deploying apps (aka no-touch apps, aka HREF EXEs, etc.). Why not? Habit I
suppose, it just really didn’t occur to me, until after I had sent out a few
updates for each of them, then I felt really silly… I’m not supposed to have
to do this anymore, sending out updates is a thing of the past!

Tonight I converted them all to HREF EXEs. I had a
little snag, it turns out that when IEExec hosts your EXE it doesn’t run it in
the same type of Apartment as when you execute it directly (which doesn’t matter for most
things, but it screws up COM automation and drag and drop), but just adding


System.Threading.Thread.CurrentThread.ApartmentState =

to the start of my app fixed that right up. (and, no, just
adding the STA attribute wouldn’t do it… in case you are

Now, if I build a new version and copy
those files to the appropriate web server directory… bang,
everyone is running the new version the next time they launch the app. No
update, no need to send out a “new version” email, unless I just want to let the
users know what is new… it is a good thing.

Tired now, must stop

Comments (5)

  1. Anonymous says:

    HREF Exe’s *rock* : Cranial wind breakage

  2. Anonymous says:

    Kent Sharkey’s blog

  3. Christopher says:

    Sure, they’re cool – granted. But, what if your end user doesn’t have dotnetfx on their machine? I’m in a field that is very restrictive on new technologies, so I think I’ll have to stick with the old method of sickening updates for rich clients. :'( boo.

  4. Tim C //Will write code for food says:

    I am having a real issue right now with IEexec not caching security credentials. We tried using NTLM to secure the app, so that we could run the stored procs in the database as that particular user. Interestingly enough this works perfectly in an intranet, yet when in an internet environ the credentials get lost as soon as IEExec finishes its download… 🙁

  5. Tim Marman says:

    I know it’s a little old, but with regards to Christopher’s comment: if your users don’t have .NET FX installed, you can’t write a WinForms application – deployed locally or via the web.

    Or, you can take a hybrid approach, deploying the base "loader" (and in the MSI install the .NET redist) which then dynamically loads all the assemblies it needs.