views:

397

answers:

1

I'm upgrading an app with many different settings files from XP to Vista and changing location of the files to use the

Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData)

line rather than write to application path. There are values used in mannnny places from property settings. Those values are getting assigned from values in the other settings files.

I've been told that Microsoft will drop support for the virtualization of the writes to Program Files which is fine and is why I am upgrading...

Would a statement like the one below cause an error during runtime or need to be handled in a certain way in Vista?

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

I'm thinking that it would assign the values during runtime and be unable store the values in the Program Files space and would probably write it to the VirtualStore? For right now this would work but when the virtualization is removed will it still work?

I'm unsure and don't want to proceed without asking first. I could be entirely off altogether. Any help or comments would be appreciated. Thanks.

A: 

We are using ClickOnce here on XP and Vista and we do not have any problem. Of course, with ClickOnce the application reside on the Document Settings of the user and this might be different for your case. But, I think the ClickOnce experience from me, may give you a partial solution.

Here is a link from someone that have using App.Config (writting) on Vista. It say that it's not a good idea to try to write to the App.Config. Here is the 2 suggestions that he proposes:

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

  • register the AppSettings section under a different name (let's say "userSettings") in app.config and specify allowExeDefinition="MachineToRoamingUser" for it. This allows you to keep the existing syntax.

Daok
thanks for your help. I better understand my question and had some new finds on the project. I was using a separate xml file apparently as well as app.config. Had to change lots of filepaths but all set.
TEEKAY