Select to view content in your preferred language

ArcGIS Pro SDK for .Net loading dlls and app.config settings

2176
5
07-08-2020 08:54 AM
CARNELL_DEVTWO
Emerging Contributor

I am trying to use some third party dlls (Entity Framework and EntityFramework.SqlServer) in my arcgis Pro sdk module. However, whenever my code runs inside ArcMap pro, I get errors like this:

No Entity Framework provider found for the ADO.NET provider with invariant name 'System.Data.SqlServerCe.4.0'. Make sure the provider is registered in the 'entityFramework' section of the application config file.

I have several stand alone apps with exactly the same app.config file "entityFramework" section which all work fine:

<entityFramework>
   <providers>
      <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices,       EntityFramework.SqlServer" />
      <provider invariantName="System.Data.SqlServerCe.4.0"       type="System.Data.Entity.SqlServerCompact.SqlCeProviderServices, EntityFramework.SqlServerCompact" />
   </providers>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlCeConnectionFactory, EntityFramework">
   <parameters>
   <parameter value="System.Data.SqlServerCe.4.0" />
   </parameters>
</defaultConnectionFactory>
</entityFramework>


During debug, I can see that the modules have loaded. In my program output I get messages like this:

C:\Users<username>\AppData\Local\ESRI\ArcGISPro\AssemblyCache{05b82a89-759c-4123-b178-75b72b968646}\EntityFramework.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.

'ArcGISPro.exe' (CLR v4.0.30319: ArcGISPro.exe): Loaded 'C:\Users<username>\AppData\Local\ESRI\ArcGISPro\AssemblyCache{05b82a89-759c-4123-b178-75b72b968646}\EntityFramework.SqlServer.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.

'ArcGISPro.exe' (CLR v4.0.30319: ArcGISPro.exe): Loaded 'Anonymously Hosted DynamicMethods Assembly'.

Loaded 'C:\WINDOWS\assembly\GAC_MSIL\System.Data.SqlServerCe\4.0.0.0__89845dcd8080cc91\System.Data.SqlServerCe.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.

I wonder if anyone else has had a similar problem, if there is some reference or app.config setting I am missing. Or if ArcGIS pro sdk for .Net doesn't read the app.config?

Tags (2)
0 Kudos
5 Replies
DHuantes
Regular Contributor

One important thing that I've learned with .Net Add-In development is that the SDK builds a <NameOfYourAddIn>.esriAddInX archive in your My Documents/ArcGIS/AddIns/ArcGISPro/{GUID_FOR_YOUR_ADDIN} folder.  This is a compressed file and if you extract it's contents with 7Zip you'll see everything the SDK deemed necessary for your AddIn.  With respect to assemblies, those will all be in the "Install" folder.  When ArcGIS Pro launches part of it's startup process is to check for Addins in the My Documents/ArcGIS/AddIns/ArcGISPro folder.  For each one it finds, with respect to AddIns, it take everything that's in the "Installs" folder and copies it to the user's App Data/Local/ESRI/ArcGISPro/AssemblyCache.  So based on your warnings this seems to all be correct.   If you had Native DLL's (i.e. C++ DLLs) dependencies, you are on your own (as I am) but that is not your issue.

Here is more extensive explanation of the same process....ProConcepts Advanced Topics · Esri/arcgis-pro-sdk Wiki · GitHub 

But again I don't think that is your problem based on the warnings... BTW those warnings are just saying you won't be able to debug into those System assemblies.

Found this on Stack Overflow..... I'm thinking this is your problem....

No Entity Framework provider found for the ADO.NET provider with invariant name 'System.Data.SqlClie... 

0 Kudos
CARNELL_DEVTWO
Emerging Contributor

Thanks for your reply,

I've been poking around in these folders a bit myself. The DLLs that I need all seem to be in the App Data/Local/ESRI/ArcGISPro/AssemblyCache folder. 

 

I really can't figure out why some packages work just fine but others don't. The only difference I can think of is that the one that doesn't work is dependent on info in the app.config file, but I don't see why that would be the problem. 

With regards to that stack overflow thread, I have added these references in both projects in the solution.

 

0 Kudos
DHuantes
Regular Contributor

Did you get it working?

I was looking for an old question I posted and saw this again.... 

Figured I'd try another search.... If you have not resolved your issue maybe this thread will help...

Use an app.config file with an ArcGIS Pro Add-In 

CARNELL_DEVTWO
Emerging Contributor

Hi Daniel, 

Thank you for following up. I actually used a workaround by piping the data to a child process totally independent of the ArcGIS Pro module! Obviously not an ideal solution. 

That link does look very hopeful and much cleaner, I will try it out and let you know. 

0 Kudos
usravank1898
New Contributor

app.config is still an issue.

I have created the  wpf .net 6 application with 3rd party dll's and these dlls read connection string information from the app.config file. This project works just fine if I reference this project in the different, NET 6 WPF project everything works fine. But if we reference it to ArcGIS Pro visual studio project Templates, AddIn can't recognize the connection string information from app.config file.

I tried copying app.config file into ArcGIS Pro bin file still not picked up by the AddIn.

 

Thanks,

S

0 Kudos