Jump to content
EduGeek EdSec 2026 is Go! 27th Oct in Derby! Join us for a day of EdTech security focused talks, networking, and an evening social ×

Recommended Posts

Posted

ok half way there - I now have an app.config file that holds the location of the file

 

Unfortunately any changes to this file by an end user doesn't have any effect

Posted

nope - the app.config does but not via properties -> settings (aka Settings.settings in VS)

 

But any changes to app.config doesnt take effect until i rebuild the solution.

Posted

You need to go to your web.config file... if you haven't got one add a Web.config file.

 

Make sure you've got an section like this:-

 

 

Then add a reference to System.Net.Configuration

 

and in code use:-

 

string setting = System.Net.Configuration.ConfigurationManager.AppSettings["settingName"]

 

or something like that. Good luck.

Posted

Ok got the Propect Properties -> Settings working and updating app.config

 

But still cant change the value after its built - even though the scope is for a user...

 

So, somehow the application isn't re-reading the app.config when its run..

Posted

Web.settings is only for web settings...

 

App.config is a file that when you're building, you shouldn't edit directly from what I've seen - Visual Studio doesn't like it.

 

The way I do it is - do all my original settings setting via the settings window in visual studio, reference them via Properties.Settings.Default.blah (remembering to save them if changing them during runtime via the program itself), and then editing the blah.exe.config file by hand if needs be, outside runtime.

 

The app.config gets turned in to blah.exe.config when you rebuild - so any changes you make to app.config will only get transferred to the blah.exe.config when you rebuild.

  • Thanks 1
Posted
You need to go to your web.config file... if you haven't got one add a Web.config file.

 

Make sure you've got an section like this:-

 

 

Then add a reference to System.Net.Configuration

 

and in code use:-

 

string setting = System.Net.Configuration.ConfigurationManager.AppSettings["settingName"]

 

or something like that. Good luck.

 

Thats pretty much what I have now - except its app.config - since this isnt a web application I'm making..

 

When I build the application it reads the value from app.config as it should, but doesnt change if app.config is edited post build

Posted
Web.settings is only for web settings...

 

App.config is a file that when you're building, you shouldn't edit directly from what I've seen - Visual Studio doesn't like it.

 

The way I do it is - do all my original settings setting via the settings window in visual studio, reference them via Properties.Settings.Default.blah (remembering to save them if changing them during runtime via the program itself), and then editing the blah.exe.config file by hand if needs be, outside runtime.

 

The app.config gets turned in to blah.exe.config when you rebuild - so any changes you make to app.config will only get transferred to the blah.exe.config when you rebuild.

 

OK that makes abit of sense - but how do i save them?

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...