Dynamically Load and Debug Plug-ins

I have two little updates on the article on John Morse's technique for dynamically loading a Revit add-in without having to restart Revit.

Debugging an Assembly Loaded from a Byte Array

First, the initial comments posted by Guy Robinson and John Morse on the topic led to some further insights, the gist of which seems to be that if you compile an add-in targeting AnyCPU then you should have not problems using this technique on x64 or x32 systems. The problem comes when either you are trying to use it like 'Edit and Continue' or compiling to x64 specific assemblies. Some important background information on the issue is provided here.

Another point to note is that it is not necessary to define a custom interface like John did, because you can use the predefined IExternalCommand one just as it is as well.

Furthermore, Load(Bytes b) is just one method of loading assemblies, and you can also use LoadFrom in the right context and LoadFile. All these methods have their advantages and disadvantages. For example, using Load, any out of the box use of Assembly.ExecutingAssembly().Location will return the location of the loader assembly instead of the add-in. The bottom line is that John's solution is not allencompassingly complete, as one might expect.

Dynamically Load RevitPythonShell Plug-in for Debugging

Secondly, Daren Thomas, the author of the Revit Python shell, just wrote and let me know that he was able to make use of John's technique to dynamically load plug-ins for debugging in RevitPythonShell as well. Congratulations, Daren, and I am very glad to hear that it is working for you!