When I use the code
Properties.Settings.Default.Save();
to save my settings it write the file to that path
%USERPROFILE%\AppData\Local\MyAppName\MyAppName.exe_Url_SomeWiredCode\TheAppVersionNumber\user.config
like
"C:\Users\Username\AppData\Local\MyApp\MyApp.exe_Url_claumreyuxtgqul2vuc3couyu5tso2n0\1.0.0.0\user.config"
How can I get the path for "the app version" folder so I can write another stuff to it?
I am using .Net Framework 4.6.2 and Visual Studio 2017.
You should be able to retrieve the file path like this:
var level = ConfigurationUserLevel.PerUserRoamingAndLocal;
var configuration = System.Configuration.ConfigurationManager.OpenExeConfiguration(level);
var configurationFilePath = configuration.FilePath
To make this work, you need to add reference to System.Configuration.dll
(right-click your WPF project, select Add, Reference... and check the box next to System.Configuration
in the Assemblies/Framework page.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With