Thursday, October 23, 2008

Revit 64-bit, and getting your applications there.

Well, we've finally updated and posted a new version of our Revit Utilities which support the new 64-bit versions of Revit 2009.





The good news is - if you're using pure Microsoft.NET - you can probably use your existing Add-in DLLs and everything will work just fine. If, on the other hand, you were making use of outside libraries, Win32 DLLs, or other things like that - then you've got some work ahead of you to get the 64-bit equivalents and figure out how to call the right one.





Why does .NET work so nicely?
Because, by default, when you make a .NET DLL it is compiled into an intermediate language called MSIL - and then it goes through the final step at runtime to become a 32-bit or 64-bit application (32-bit applications need 32-bit DLLs, and 64-bit applications, generally, need 64-bit DLLs). But by default, you build your .NET DLLs to run on "Any CPU":




What definitely needs a change? The Installer :(


So you've got your DLL working - and maybe that was easy... but that's really just the beginning. The installer is where it's a bit more of a pain. Here's why:

1. Registry

If you're reading registry keys to find out the location of Revit (so that you could update the REVIT.INI file) - you've got three new things to look for. Unfortunately, the only way to find where Revit is installed is look at the Uninstall registry keys in HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall.

The new keys for 64-bit Revit are:

  • {D2466208-7348-4214-B01E-7BC8729E2BD3} (Revit 2009 Arch 64)
  • {4A98F976-01B5-40E8-A496-AEFD85C3A446} (Revit 2009 MEP 64)
  • {C4B3B3C3-2EE9-48D3-9BF5-4443F7ECF759} (Revit 2009 Struct 64)


2. Another scenario - 32-bit Revit on a 64-bit OS

While this should become uncommon quickly - I've been AMAZED at how many users worldwide are running a 32-bit Revit on a 64-bit OS. Sure, it gives you access to a couple more GIGs of RAM - but oh, the headaches :).

In terms of our own headaches - the biggest one is that Revit's uninstall registry key lies about where Revit is installed (it's actually installed in the C:\Program Files (x86) folder in this case - but that's not what it says).

Also, when you deal with the Registry in general in this scenario, Windows keeps a separate parallel registry for 32-bit applications versus 64-bit applications (check out HKLM\SOFTWARE\WOW6432Node - and find the parallel registry universe).


All in all, if you're doing pure .NET work - it's mostly installer work to get your stuff onto Revit 64. If you're a commercial developer - get moving, because they're jumping to it like you wouldn't believe!