Convert winform from XP to Vista - Properties.Settings

I am updating an application with many different settings files from XP to Vista and changing the location of the files to use

Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData)

      

rather than writing to the application path. Values โ€‹โ€‹used in mannnny places from property settings. These values โ€‹โ€‹are obtained from values โ€‹โ€‹in other configuration files.

I was told that Microsoft will drop support for virtualization of records in Program Files, which is fine, and so I am updating ...

Could a statement like the one below cause a runtime error or should it be handled in a specific way in Vista?

Properties.Settings.Default.Properties["ConnectionString"].DefaultValue = config.ConnectionString;

      

I think it will assign values โ€‹โ€‹at runtime and won't be able to store the values โ€‹โ€‹in the Program Files space and probably write it to the VirtualStore? This will work for now, but when virtualization is removed, will it still work?

I am not sure and do not want to continue without asking first. I could completely step back. Any help or comments would be appreciated. Thank.

0


source to share


1 answer


We are using ClickOnce here on XP and Vista and we have no problem. Of course, with ClickOnce, the application is in the settings of the user's document, and this may be different for your case. But, I think the ClickOnce experience from me can give you a partial solution.

Here is a link from someone who has an App.Config application (writing) in Vista. He says that you shouldn't try to write in App.Config. Here are the two suggestions he offers:



  • use a .settings file, it gives you strongly typed settings and user / app scope for each property, save and property change notification

  • register the AppSettings section with a different name (say "userSettings") in app.config and set it to allowExeDefinition = "MachineToRoamingUser". This allows the existing syntax to be preserved.

0


source







All Articles