Trying to have persistent addon configurations

48 views
Skip to first unread message

Remi J.

unread,
Mar 10, 2023, 6:20:22 AM3/10/23
to Excel-DNA
Hi, as I am saying in the title, I am trying to get a configuration file to work
I am targetting .NET 6, using version 1.6.1-beta3 of ExcelDNA

I tried stuff from old posts using System.Configuration.ConfigurationManager but as soon as I include System.Configuration in my project, I get Exceptoins thrown everywhere about Missing Methods from Windows Forms or something like that (One has ExcelDna Logging as a source and the second one is ExcelDna Intellisense)

I also tried using a .settings file just like I have in another addon but it's not ExcelDna-based so probably not the same behaviour

If possible i would prefer to use an internal config file (one I dont have to read and write from with file system calls like having a config.json file on the side of my .xll)
Or if you have any other solution that would result in a persistent configuration state, I'd be glad to hear about it!

Thank you for any help provided.
- Remi

Govert van Drimmelen

unread,
Mar 11, 2023, 2:09:45 AM3/11/23
to Excel-DNA
Hi Remi,

For .NET 6, I think the recommended library is Microsoft.Extensions.Configuration.XXX.
There is support for json and xml file formats and extensibility.

If you don't want to manage a physical file, the registry might be a good option.
There is a .NET package Microsoft.Win32.Registry for access to the registry.

I don't have experience with any of these, so it would be good to hear what you find and decide to do.

-Govert
Reply all
Reply to author
Forward
0 new messages