Search code examples
c#.netapplication-settings

Get the path to the current application settings file


I have so many bloody different nested folders with different names that were all automatically created by the settings engine that I can no longer tell where the active settings file resides on my machine. Is there a way to determine the path to the active settings file programmatically so I can output it to a debug console?


Solution

  • It isn't often that I can post the exact same answer within 2 minutes. Copy-and-paste:

    I'm going to be a bit blunt about this. The .NET framework design is overall rather excellent. Easy to learn, few surprises, no fat. But not everything is great. System.Configuration has a very high suck factor. Between an absurdly complicated object model and an implementation that was paralyzed by security concerns, it inevitably becomes a PITA when you try to extend it beyond the point-and-click settings designer.

    Just don't go there. Using XML serialization to load/save your own configuration class(es) is a wholeheckofalot easier than battling that borked design.