I have a console application in which I want to write the name of a file.
Process.Start("blah.bat");
Normally, I would have something like that in windows application by writing the name of the file 'blah.bat'
to Settings file in Properties.
However, here I didn't find any Settings file and I added an app.config for the same purpose.
I am not sure what to write here in app.config, that would lead to me to achieve similar thing as in Windows Forms.
For eg: In windows forms. Process.Start(Properties.Settings.Default.BatchFile);
where BatchFile
is a string in settings file in Properties.
For .NET Core, add System.Configuration.ConfigurationManager from NuGet manager.
And read appSetting from App.config
<appSettings>
<add key="appSetting1" value="1000" />
</appSettings>
Add System.Configuration.ConfigurationManager from NuGet Manager
ConfigurationManager.AppSettings.Get("appSetting1")
use this
System.Configuration.ConfigurationSettings.AppSettings.Get("Keyname")
Source: Stackoverflow.com