views:

107

answers:

1

I've noticed in Visual C# 2010, whenever you change the target framework version away from the default 4.0 client profile (and even if you change it back afterwards), the IDE creates a. config file that it clearly thinks ought to be shipped with the program. The .config file basically just says what the supported/target framework version is.

Now, as far as I've been able to tell from a Google search, if that file is not present, the fallback is to try to run the program against the framework version it was built against.

Since that is presumably the same as the version the .config file says, doesn't that mean the .config file has no effect and can be omitted? Or am I missing something?

+5  A: 

If the version you compiled with is the same as the version you want to run in then yes it is not required to keep this config file. But say you compiled for .Net 2.0 and want to force your assembly to run in the .Net 4.0 runtime. You could use this setting to affect your application. You could also use this to force your application to use different versions of the runtime if they cause known issues with your application. (I haven't seen any problems like this yet so I can only speculate.)

Matthew Whited
So the idea of the config file is that it's there if you want to customize the settings, but you don't need the default one? Okay, thanks.
rwallace
Correct. You could even use the machine and user config files... but these runtime settings would probably be a very poor choice to change at that level.
Matthew Whited