C# – Application settings error after changing target framework of project

app-configapplication-settingscnet

In my application I am using user settings as explained here.
Then I realized that in VS 2010 I was using .NET 4.0 while only .NET 2.0 was sufficient.

When I changed the framework and build the project, in my code whenever I access setting now, I get the following error:

An error occurred creating the
configuration section handler for
userSettings/Vegi_Manager.Properties.Settings:
Could not load file or assembly
'System, Version=4.0.0.0,
Culture=neutral,
PublicKeyToken=b77a5c561934e089' or
one of its dependencies. The system
cannot find the file specified.
(C:\Users\AKSHAY\AppData\Local\Microsoft\Vegi-Manager.vshost.exe_Url_44035dlkzpfaaauiqsd4nh3f0l0yq0tv\1.0.0.0\user.config
line 5)

It is for unknown reasons using version 4.0.
Please suggest what should I do.

Best Answer

Check out your app.config maybe you still have System.Configuration.UserSettingsGroup or something of that sort of version 4 still lurking around, you will have to manually edit and get the relevant for version 2