Select to view content in your preferred language

Where to install AddIn referenced DLL's?

5507
12
10-09-2018 07:20 AM
RomanTrojan
Emerging Contributor

My AddIn is referencing another own component. All DLL's are installed in one configured Add Ins folder. But Arc Pro crashes that way! I have found out working folder, but I suppose it must be more professional?
C:\Users\*\AppData\Local\ESRI\ArcGISPro\AssemblyCache\{GUID}

0 Kudos
12 Replies
GKmieliauskas
Esri Regular Contributor

Hi,

Your AddIn is zip file package which includes all referenced dlls. To add  them automatically to zip in Visual Studio AddIn project dll reference properties set Copy to local property to True.

RomanTrojan
Emerging Contributor

Thank you for reply but copying Add-In referenced DLL’s to configured Add-Ins folder causes Arc Pro to crash while invoke to run further referenced code as on Add-In itself.

I am searching for an appropriate folder to debug and deploy any (not ArcGIS) DLL’s which are referenced by a custom Pro Add-In. Following there are some scenarios to place further referenced DLL’s evaluated with actual version ArcGIS Pro 2.2.3. Actually I tend to use ArcGIS Pro Extensions folder.

Does not work (crash):

  • Add-In Manager configured Add-Ins folder e.g. D:\my disk\Pro\Test
  • Well known folder e.g. C:\Users\*\Documents\ArcGIS\AddIns\ArcGISPro


Works, but not appropriate:

  • Add-In working folder e.g. C:\Users\*\AppData\Local\ESRI\ArcGISPro\AssemblyCache\{GUID}
  • GAC folder C:\Windows\Microsoft.NET\assembly\GAC_MSIL

Works, maybe appropriate?

  • ArcGIS Pro Extensions folder C:\Program Files\ArcGIS\Pro\bin\Extensions
0 Kudos
GKmieliauskas
Esri Regular Contributor

Hi Roman,

We have solution with 11 projects. Some of them have AddIns, some of them are helpers. All application works fine in folder C:\Program Files\xxxxxxxx.

At first you need to clean up all copies of referenced dll from disk. After that each reference of your additional library you need to set “Copy to local” to True.

Your library must be in the same solution as your AddIn.

Next thing you need to setup project dependencies using “Building dependencies- Project dependencies”. Check each library your AddIn uses. Now each time when you build your project, your additional libraries will be built too.

There is one problem with debugging. You can’t go from library to library and back, because your AddIn takes library not from your solution, but from AddIn zip file. So you can debug only StartUp project. Each time you change your additional library code, you need to go and rebuild your AddIns which uses additional library.

To check is your additional library is included to AddIn , rename xxxx.esriAddinX to xxxx.zip file and check its content with your archiving software or go to AddIns folder, locate folder where your AddIn dll is stored and check if your additional dll library is stored in the same folder.

0 Kudos
RomanTrojan
Emerging Contributor

Hi Gintautas,

Thank you for your extensive elucidations! I hope it helps some developers. For me there is no problem with additional libraries container because everything works at some special folders as described earlier. I am also aware to take care of actual version for debugging. My question has more .NET deploy nature on how to make configured Pro Add-Ins folder, well known folder or any other folder e.g. C:\Program Files\xxxxxxxx for not to crash ArcGIS Pro but to be known that way as C:\Program Files\ArcGIS\Pro\bin\Extensions does? I have .NET knowledge lack there and not unlimited time to search for the appropriate technique. My goal is to deploy package including additional libraries to Add-Ins folder as configured by ArcGIS Pro user without crash scenario.

0 Kudos
RomanTrojan
Emerging Contributor

I am back on this path again trying to present my dilemma more accurate and clearly.

The additional library DLL’s reference property “Copy to local” cannot be set to True because some of my assemblies are late binding and therefore not listed as references on my Add-In. It is an optional entrance to a smart system with core components which serves not only ArcPro but ArcMap commands or other containers like GeoPackage as well. Dependent on the calling mode some different libraries are linked at run-time based on System.Reflection.Assembly.Load/LoadFrom function. For this case I intend to use the ArcPro extensions folder C:\Program Files\ArcGIS\Pro\bin\Extensions\* (this works well) or invoke additional .NET configuration.

On the other hand, I dislike copying all the same libraries for each of many Add-Ins to theirs working folder C:\Users\*\AppData\Local\ESRI\ArcGISPro\AssemblyCache\{GUID} with “Copy to local” flag for current user and Add-In GUID.

0 Kudos
GKmieliauskas
Esri Regular Contributor

I think AddIns technology is not very friendly for 3rd party big developments. There is another one problem with developing AddIns on ArcGIS Pro. It is AddIns resources. There is only one way to specify your own resources as relative path from ArcGIS Pro installation folder. I think we need support from Esri what is better way to develop big extensions on ArcGIS Pro.

0 Kudos
BartVan_Hoecke
Emerging Contributor

You can also try to use the AppDomain.CurrentDomain.AssemblyResolve ResolveEventHandler.

Each time ArcGIS Pro would try to resolve an assembly for your addin, it would be fired.Off course you'll need a way to identify if your loading a 'standard' ESRI library or own of your other third party dlls. Because for the first case you should let it go through the default logic. In the second case you could try to load it from a specific path.

This might get you started:

c# - Working with AppDomain.AssemblyResolve event - Stack Overflow 

I think this implementation should happen at the very first 'addin' loading. In other words: where you implement the  ArcGIS.Desktop.Framework.Contracts.Module.

HTH,

Bart

0 Kudos
RomanTrojan
Emerging Contributor

Yes, I guess my ArcPro AddIn referencing other DLLs (partly late binding) needs additional code to work on any folder specified by a user. It is another concept as I am familiar using ArcMap command. Thank you, Bart!

0 Kudos
NareshNagandla
Emerging Contributor

Hi guys, I am unable to deploy my solution in VM. its not giving me any error but my dockpane doesn't display anything. It just comes with blank. 

In my development machine it all works fine only in VM where Arcgis pro was installed it is having this issues.

I have copied my thrid party dlls into the folder 

C:\Program Files\ArcGIS\Pro\bin

I have also set “Copy to local” to True. in VS.  I am unable to find where the issue could be. I have also added logging functionality and its not even coming to my logging code and I am not sure what I am missing. 

Having dockpane as blank is something I am unable to debug. Can someone please help me on this??

0 Kudos