Category Archives: Navisworks

How to Debug/Run Navisworks 2013 API Programs

Of course you can just type in code, click build, go to Windows Explorer, copy your dll files to Plugins folder, start Navisworks and click the buttons on the Add-in tab. But what’s fun with that? Besides, that will not give you useful real-time info for debugging. Here in this blog I present you some simple configurations that can make your API life a little bit easier.

Use Post-build Event

Using post-build event to copy the generated dll file (and pdb file for debugging) to the destination folder in Plugins.

1. Right-click the project, choose Properties.

2. Click the Build Events tab on the left, copy the following to the “Post-build event command line”:

xcopy /Y “$(TargetDir)*.*” “C:\Program Files\Autodesk\Navisworks Manage 2013\Plugins\$(TargetName)\”

The “xcopy” is a Windows command for copying stuff. The “/Y” is a switch that tells the system to overwrite anything in the destination folder without letting the user confirm.

The $(Xyz) are macros that will be replaced by actually values. For example, on my machine it will be replaced as “xcopy /Y “D:\zhangle\BIM\Navisworks\API\myVsProjects\LeZhangPlugin\LeZhangPlugin\bin\Debug\*.*” “C:\Program Files\Autodesk\Navisworks Manage 2013\Plugins\LeZhangPlugin\””. Using the macros are good for code portability and ease to read and understand. If your Navisworks is not installed at the default folder, you need to adjust the destination folder accordingly. If you want to know all the macros, you may want to click the “Edit Post-build …” button, and click the “Macros” button.

Configure Start Action

If you just click the “Start” button in VS just like you are doing for any stand-alone application, VS will show you the following error message. Indeed, what we have created is a “Class Library” project, which generates a dll file. We need somehow trigger Navisworks first and run our program in it.


1. Right-click your project name in the Solution Explorer, and click Properties, which is at the bottom of the pop-up menu.

2. Click Debug tab on the left; in Start Action group, choose “Start external program”. Click the browse button to go to Navisworks installation folder, and choose “Roamer.exe”. (I have no idea about the name, but trust me.) Save and close the project properties page.

3. In the code you want to run and debug, find an interesting statement and click the left side border of the code window as shown below. A red dot should be added as a “break point”, which means when running, the program will stop BEFORE running this statement to give you a chance to look into the status of the program.


4. Click the Start button in VS again. Navisworks should start automatically.

5. Do something that will trigger your break point code. You will notice that your program will stop at the statement, while you can check the program status and use the different debug tools.


Keep these in mind if a strange bug appears

Check which .NET framework you are using. Right-click your project – Properties. Make sure the “Target framework” is selected as .NET Framework 4. Since VS2012 uses .NET 4.5 as the default framework, some strange bugs may be as a result of the compatibility between different .NET framework versions. In one of my VS2012 project using Autodesk.Navisworks.Automation.dll, the assembly can be added into the reference without errors, but when running it throws “FileNotFoundException” on the Automation file. Changing the framework back to 4 then works fines.

NOTE: This is a re-post due to broken links on website transfer. The original link to this page is:​sworks-2013-api-programs/