Tuesday, September 16, 2014

Cannot Register Assembly for ESRI.ArcGIS.Desktop.AddIns

I'm doing a lot of coding in Visual Studio 2010 for ArcGIS Desktop Add-ins at 10.2. Every few saves (build/rebuild solutions/etc.) I get an annoying message:
Cannot register assembly "[path to my project]\[Projectname].dll". Could not load file or assemly ' ESRI.ArcGIS.Desktop.AddIns, Version=10.2.0.0, Culture=neutral, PublicKeyToken=[Unique Token]' or ont of its dependencies. They system cannot find the file specified.
Screenshot of the error in the Error List window
Try one or both of the following procedures to solve this problem.

Disable COM Interop Registraion

Some Esri forum posts mentioned to sure the "Register for COM interop" setting was disabled. Here's how to find it in Visual Studio 2010:

  • Go to the Properties window for the project from the Solution Explorer
  • Navigate to the Compile tab
  • Uncheck Register for Com interop toward the bottom of the page

  • Close and re-open Visual Studio and it should solve the issue.  If not, try the next step that we've been using a bit

Remove & Re-Add AddIns Reference

This usually only works for a few hours, or up to a few days, but it'll definitely solve the problem so you can continue work.
  • Open the Properties window for the project again, but navigate to the References tab.
  • Scroll down through the references and look for ESRI.ArcGIS.Desktop.AddIns under the Reference Name field. Highlight it and click the Remove button

  • Click the Add button just to the left of the Remove button and choose Reference...
  • Navigate to the .NET tab
  • Scroll down a ways (further than you might think; it's not necessarily in alphanumerical order) to find the ESRI.ArcGIS.Desktop.AddIns component.  Select it and click OK to add it. As long as you removed it in the previous step, it will be included in this list.
  • Close Visual Studio.  When you open it again, the problem will be fixed


No comments: