image by archi-lab

building revit plug-ins with visual studio: part one

image by archi-lab

I am actually going to teach this to a colleague of mine that will be visiting our office next week so I figured that if I write it down as a post, then I will have a great post tutorial material that he can reference later.

Anyways, here it is: how to write “proper” Revit add-ins using Visual Studio. This means that we will compile them into *.DLL files at the end, and they will be easily distribute-able as opposed to a Revit Macro that would remain attached to a Revit project file.

The functionality that we will cover will be a very simple utility that will allow you to select bunch of Detail Lines in Revit and will tell you what is their total length (let’s say in FT, M, MM and INCH).

In this post I will cover very basic setup stuff:

  • Download Visual Studio Community 2015
  • Create new Project
  • Reference Revit API libraries

First things first, we need Visual Studio. I personally use the free Visual Studio Community 2015 that can be downloaded at:

Once downloaded fire it up. You should be greeted by a screen that looks like this:


Click on New Project…


  1. Select Visual C# from the list on the left of the screen.
  2. Select Class Library from the list on the right of the new pop-up window.
  3. Specify a name for the new Project.
  4. Select location on your drive that project will be stored at.*

* I usually store my plug-in work on my Google Drive. It allows me to work on it at work, then without posting the files and any hassle I can access all of my files at home or any other location for that matter.


Couple of things to pay attention to when we create a new project and for those of you that are new to Visual Studio this is probably as much as I will go into where things are:

  1. This is usually where you want to put your “import” statements (for those of you familiar with Python). For those of you that are new this is where we specify any external libraries that we want to use in our project (RevitAPI and RevitUI libraries will be imported here but that’s in a minute).
  2. This is area that we will be putting our code in.
  3. This is your project browser. It contains a list of References (external libraries) as well as all of the classes and resources that we want to use in our project.
  4. This is your Console. For our purposes all you need to know is that this is where you will get all of the errors and other messages to display when we are running our application. It’s usually first place that you want to look at when something doesn’t work.

Since we are making a Revit plug-in let’s first reference in two of the Revit libraries that we will be using.


  1. Right Click (RC) on References in our Solution Explorer and Add References…


  1. Select Browse from the list on the left side of the screen.
  2. Click on Browse… at the bottom of the screen.

New window will pop up:


  1. Navigate to where your Revit copy is installed. Typically it will be in the highlighted location. Also, remember that if you want to build a plug-in for Revit 2016, you must reference in libraries from that version of Revit.
  2. Select RevitAPI.dll
  3. Select RevitAPIUI.dll
  4. Click Add


  1. Select both of the previously mentioned libraries.
  2. Click OK.

Now, that we have referenced our libraries into our project you should be able to see the under the References drop-down:


  1. Select both of them (you can hold CTRL and Right Click).
  2. Under Properties, change their Copy Local setting to False.

This will prevent both of these files to be copied to our assembly when we are ready to Build our plug-in.

This is pretty much all there is to this first part. We are ready to move on to Part 2 during which I want to cover IExternalCommand, good practice of using pseudo code, exceptions and addin file. I am keeping it slow for now, but I will cover a lot more ground once we start dealing with actual code and maybe even UI elements in the future.

Leave a Comment