Question

I am using the NINI project to create ini configuration files. When attempting to save to the config file I get "IniException was unhandled Expected assignment operator (=)." When looking at the NINI documentation, I am writing the code exactly the same, but I cannot figure this error out. Heres my code. Any ideas?

using Nini.Ini;
using Nini.Config;
IniDocument doc = new IniDocument("Settings.ini", IniFileType.WindowsStyle);
IniConfigSource source = new IniConfigSource(doc);
source.Configs["[System]"].Set("InstallDirectory", acmInstallDirTextbox.Text);
source.Save();

No correct solution

OTHER TIPS

Try following code:

IniConfigSource source = new IniConfigSource("Settings.ini");
source.Configs["System"].Set("InstallDirectory", @"C:\Program Files(x86)\Test");
source.Save();

or

IniDocument doc = new IniDocument("Settings.ini", IniFileType.WindowsStyle);
doc.Sections["System"].Set("InstallDirectory", @"C:\Program Files(x86)\Test2");
doc.Save("Settings.ini");
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top