How to Upgrade your Revit Application Macros to a New Release

Tags: , , , ,

Date: March 29, 2016

If you are actively creating Revit Application Macros, you’ll love this tip.  There is no reason to manually recreate your macro library by exporting and importing the class files or using copy paste with two different versions of Revit open.  The steps I take to update the library of macros from one Revit release to the next are as follows (example 2015 upgrade to 2016):

Open an explorer window and navigate to C:ProgramDataAutodeskRevitMacros

If you’ve not run the Macro editor in the latest version of Revit yet, you may not have the year folder here.

image001

Have no fear, just launch Revit, open a project, click Manage Ribbon and click the Macros button.

image002

This will create the correct set of folders and import all the dlls needed by the editor.

image003

Once that is complete, navigate to the last version subfolder under Macros and click into the AppHookup subfolder.  In this example it is this path:

C:ProgramDataAutodeskRevitMacros2015AppHookupimage005

Inside this subfolder you’ll find subfolders named after each “module” you’ve created previously.  To upgrade, select the folder under AppHookup and copy it to your clipboard.  Navigate to the 2016AppHookup folder and paste there.image007

Once all the files have been copied over, there are two files that should be updated:

  • <ProjName>.<Language>proj.FileListAbsolute.txt
  • CopyHere.txt

Each of the files listed above contain paths to the old version (2015).  They will be found in different places within the copied folders.  You can search for these files or simply click through until you find them.  I use a tool called Agent Ransack to search for text strings within files. The FileListAbsolute text file is under the debug branch.

C:ProgramDataAutodeskRevitMacros2016RevitAppHookupBTC_UtilsSourceBTC_UtilsobjDebugimage009

Note: the structure of the path above contains two subfolders with the module name in it.

Open notepad and choose to open your version of the FileListAbsolute text file.  Since my module was written in C# and the name was BTC_Utils, the resulting file name is: BTC_Utils.csproj.FileListAbsolute.txt

Perform a search and replace on “/2015/” replacing it with “/2016/” as shown in the image below. image011

Save and close the file.  Do the same for the CopyHere.txt file.

image013

Once that is complete, launch the new version of Revit, open a project, and click the Macro Manager. When the macro manager dialog opens, find your module name on the “Application” tab.  Select it and then click the “Edit” button to open the SharpDevelop Editor.image015

Once the editor is open, click on the “Build” menu item and choose to “Rebuild” your project. image016

This will update the cache files that are created.  You may have found some of these if you performed a search using a tool like Agent Ransack.

Note: you can also delete these cache files and the editor will recreate them the first time the macros are run or rebuilt in this case.

If there were any API changes between the releases, you will have to resolve those.  The upgrade from 2015 to 2016 was fairly uneventful to my macros.  Good luck in your upgrades.

By: Richard Binning, Director of BIM Technology; Check out his blog: Beside the Cursor; http://www.integr-8.com/