Esri .NET tool addin "register assembly" error

463
4
Jump to solution
02-29-2012 05:24 AM
Gregde_Bruin
New Contributor III
Hello all,

I'm new to programming and, as an introduction, I'm trying to add a tool to existing sample code I took from ESRI, SelectionSample2008. The problem is that it seems if I change anything, even if I change it back perfectly with ctrl-z, the project no longer builds.

I get this error:

Cannot register assembly "H:\AppDev\Visual Studio 2010\Projects\GdBSanitaryFromSelectionAddInSample\bin\Debug\GbdSanitary.dll". Could not load file or assembly 'ESRI.ArcGIS.Desktop.AddIns, Version=10.0.0.0, Culture=neutral, PublicKeyToken=8fc3cc631e44ad86' or one of its dependencies. The system cannot find the file specified. SelectionSample2008

Can someone please explain to me the nature of this error, or perhaps point me in the direction of a resource, walkthrough or link for adding tools to existing toolbars/extensions?

Any help is greatly appreciated.

Thank you,
cdebruin
0 Kudos
1 Solution

Accepted Solutions
RichardWatson
Frequent Contributor
I cannot comment on the sample.  What I can say is that you debug it yourself.  There are 2 aspects here.  The first is the steps within the Visual Studio project which are attempting to call ERSIRegAsm.  You can check and make sure that they are correct.  The second thing that you can do is to use a tool like fuslogvw in order to debug any assembly loading errors.

If you don't want to debug it then my suggestion is to file an incident with ESRI support.

View solution in original post

0 Kudos
4 Replies
Gregde_Bruin
New Contributor III
After playing around a bit, I've discovered that arbitrarily building the solution three times fixes the problem.
The first build gives me the "Cannot register assembly" error.
Second build after no changes made to code yields "build failed."
Third build after no changes made to coded yields "build succeeded," and the program works as it should.
I'll reiterate that no changes were made to code. Fingers off the keyboard, cursor not leaving the build menu, no changes made to code.

I'd still like an explanation here. My mind isn't at ease even with the program working, and I can't be forced to build the solution three times after every code edit.
0 Kudos
RichardWatson
Frequent Contributor
I cannot comment on the sample.  What I can say is that you debug it yourself.  There are 2 aspects here.  The first is the steps within the Visual Studio project which are attempting to call ERSIRegAsm.  You can check and make sure that they are correct.  The second thing that you can do is to use a tool like fuslogvw in order to debug any assembly loading errors.

If you don't want to debug it then my suggestion is to file an incident with ESRI support.
0 Kudos
Gregde_Bruin
New Contributor III
Thank you for the support. I've since given up on building off less than adequate ESRI samples and moved onto building a new solution from scratch.
0 Kudos
FabianCastellanos
New Contributor
Hi all,

When you add one add-in item (Button, Tool, .....) to your project, assembly reference ESRI.ArcGIS.Add-Ins set property "copy local" to "False", then you should change to "True". Re-build your project and run the application.

Regards,
0 Kudos