0

My C# DLL project has settings and the defaut values are held automatically in the xxx.dll.cong file.

When I perform a save of the settings:

Properties.Settings.Default.Save();

They are correctly read back in when I display my form. But I can't work out where the users saved version of the config file is kept? I tried to look in %localappdata% and nothing is there.

To summarise:

  1. This is a .Net DLL tool bring run inside BricsCAD.
  2. We are using the Properties.Settings concept.
  3. Where is the users Save() version of the file kept?

Update

This is the closest conversation I could find about this subject (related to AutoCAD). It is still relevant because my tool is used by three CAD packages:

  • AutoCAD
  • BricsCAD
  • ZWCAD

But the linked discussion does not actually answer my question. Clearly the "settings" are persisting. But they are not persisting in the %localappdat% folder for my tool. I have now tested with both BricsCAD and ZWCAD and still can't find them.


According to this article the configuration file should be updated. But the config file where the DLL is is not updating. Even though the mechanism works. The persisted settings are somewhere else.

Andrew Truckle
  • 17,769
  • 16
  • 66
  • 164

1 Answers1

0

I decided to use the MS-DOS command findstr in a console window:

findstr /s "SaveToDXF_DuplicateCreateCount" *.config

I performned the test on my C drive and it came up with three files and one of them seemed to be the file of interest:

c:\Users\[USERNAME]\AppData\Local\Bricsys\DefaultDomain_Path_LOTSOFCHARACTERS\21.2.06.0\user.config

The LOTSOFCHARACTERS was a weird sequence of text. But when I open that user.config file it had my current settings.

I am not sure as the the reason for my settings being persisted in this manner.


This answer (https://stackoverflow.com/a/60117461/2287576) prrovided to a differeht question actually explains the aforementioned. To quote:

User Settings (Settings in the User scope) (applies to Visual Studio 2017+) These settings are stored along with the Application settings, but have associated local storage files, used to store values that a User (or the Application) can change at run-time:

2.1 A user.config file stored in the current User profile in the

[User]/AppData/Local/[CompanyName]/[ProductName].exe_<hash>/[Assembly Version]  

section, if the setting's Roaming attribute is set to false.

2.2 A user.config file stored in the current User profile in the

[User]/AppData/Roaming/[CompanyName]/[ProductName]/[File Version]

section, if the setting Roaming attribute is set to true instead.

Andrew Truckle
  • 17,769
  • 16
  • 66
  • 164