c# - Loading app.config file in Release -
in visual studio 2008 project, i've added app.config file store app-data in xml format.
i read data in code this:
string somedata = configurationsettings.appsettings["somedatakey"].tostring();
when start application in visual studio, works. if try run exe file (release or debug) error (if debuf it breaks on line above):
object reference not set instance of object.
the file app.config not inside folder.
is app.config file in same folder exe? if not, copy there.
starting debugging in visual studio builds everything, , copies output (including app.config) output folder, starting there.
Comments
Post a Comment