How to access connection string in VS2012 WPF application from app.config?
.net, c#
Solution
Go to references, and add a reference to `System.Configuration`.
Problem
I am using VS2012. I have to keep connection string in app.config and have to access it from my cs file. But I am unable to do it in VS2012. Following is what I have found from net but I think it works on earlier version of VS not on VS2012. app.config file ``` <?xml version="1.0" encoding="utf-8" ?> <configuration> <startup> <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" /> </startup> <connectionStrings> <add name="DataFormConnection" connectionString="Data Source=abcdd;database=xyz;uid=4566;pwd=987" providerName="System.Data.SqlClient" /> </connectionStrings> </configuration> ``` How I am accessing it: ``` connectionString = ConfigurationManager.ConnectionStrings["DataFormConnection"].ConnectionString; ``` Getting error: type or name does not exist in System.Configuration.ConfiguarationSettings