I am trying to add the ConfigurationMangager
in my programm. I've already tried to add the System.Configuration
and System.Configuration.Install
reference but nothing works. Is there any other way I could fix this problem?
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Data.SqlClient;
using System.Configuration;
namespace Gmos.Halbtax.Models
{
static class Program
{
public static void connectDB()
{
string connString = ConfigurationManager.AppSettings["ConnString"].ToString();
SqlConnection conn = new SqlConnection(connString);
}
}
}
Make Sure Target framework is NET framework 4
and the version you select for System.Configuration
is v4.0.0.0
Add System.Configuration
in your project by clicking add Reference on your project
To check go to your Project Properties -> Application -> Target framework
Hope this will hep you.