Debugging Visual Studio Add-Ins

When a new Visual Studio Add-In project is created, it can be easily debugged just like any other project using F5 Key. But there are a few complications in debugging when a few factors change.

I was working on a Visual Studio Add-In. Suddenly I was unable to debug the Add-In project. Then after some investigation I figured out the root cause. I had renamed a folder which contained all my projects which broke the expected behaviour. Below are my findings which can help fix issues in such cases.

*.AddIn file:

This file is resides in the add-ins folder. Visual Studio is typically looks for add-ins to load in predefined folders. One of them is the folder: C:Users<username>DocumentsVisual Studio 20xxAddins. These folders can be configured under menu Tools > Options > Add-in Security. This file contains the path of the Visual Studio Add-In binary to be loaded. This is one of the most common reasons for the debugging issues when the paths change. Just change the path in this *.addin file to point to the Visual Studio add-in binary in bin folder of the project. Please check below the contents of this file in a default add-in project.

Visual Studio *.AddIn file

Settings under Project Properties > Debug:

Once the file path issue is fixed in the *.addin file, the Visual Studio Add In can be loaded and debugged. In a few cases you might need to do that manually. That is, you will need to manually launch a new instance of Visual Studio and then attach process through DEBUG > Attach to Process… To fix this, a few changes in the project properties will be needed. Change the properties as given in the below screenshot. Once these changes are made, just hitting F5 will load the add-in in a new instance of Visual Studio to debug.

Visual Studio Add In Project Properties

Share This!

Leave a Reply

Your email address will not be published. Required fields are marked *