question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

User.config file path should have the name of the add-in's assembly

See original GitHub issue

As part of investigating #143 I’ve noticed that the ExcelDna’s assembly is being used as evidence for the user.config file, and therefore any ExcelDna add-in user.config is written to a path that looks like %localappdata%\Microsoft_Corporation\FullTrustSandbox(Excel-DN_Path_jojpsvsna1vaszvd35jsryd0vnvv001i\16.0.8431.2079.

This means that different add-ins, running in different AppDomains, etc. will all share the same user.config file, instead of having their own.

We should consider implementing our own HostSecurityManager or our own SettingsProvider and customize this path, using the assembly evidence from the main add-in assembly, instead of using the ExcelDna’s one.

Issue Analytics

  • State:open
  • Created 6 years ago
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
augustoproietecommented, Feb 12, 2019

@markns I haven’t spent any time on this one yet. I believe the ideal fix would be to set the FriendlyName of the initial AppDomain to the name of the add-in defined in the .dna file (Name property), and everything would flow through.

An alternative approach would be to do the same, but from the C# side, when the FullTrustSandbox domain gets created.

In the meantime, I’d suggest using a custom user config file that you handle yourself using JSON, XML, HOCON, etc.

0reactions
PGsHubcommented, Jul 6, 2020

Thanks for the update. Since Excel updates (which happen quite often) create new settings folders, I have now also moved to using my own settings file in JSON format. A lot more flexibility with this approach.

The only sensible solution to using the .NET config files seems to be creating a custom settings provider like in https://stackoverflow.com/a/11398536/7000882 in the ExcelDNA assembly using the name of the main add-in assembly from the .dna file. But I am also not sure if this is worth the effort.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Where is the location for Add-in Configuration set...
This way the user can add their own file paths via the configuration file ([my addin name].dll.config). I'm pretty new to VB development...
Read more >
"Failed to initialize the add-in [add-in name] because ...
Failed to initialize the add-in <add-in name> because the assembly <path to an add-in DLL file> does not exist. Causes: Revit discovers Add-ons...
Read more >
ArcMap Add-in with app.settings not recognizing ...
I figured out how to configure the addin. The addin file in ...Documents\ArcGIS\AddIns\Desktop10.0... gets expanded every time ArcMap loads, ...
Read more >
Specify the add-in path in .addin file in an installer
Since Inventor . addin file is quite simple, we could just finds the <assembly> node directly and change the path.
Read more >
user.config location? - Add-in Express .NET forum
Try looking for the .config file starting from System.Reflection.Assembly.GetExecutingAssembly().CodeBase. Andrei Smolin Add-in Express Team ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found