我看到一個非常不錯的文章在這裏約我想要做什麼,ConfigurationManager - 如何在.NET 3.5中使用連接字符串?
.net 3.5: To read connectionstring from app.config?
它說,使用ConfigurationManager中類。我無法引用ConfigurationManager類。
如果我看看我正在使用的system.dll(這是v2.0.50727),沒有ConfigurationManager類。
我使用VS 2008,我的項目設置爲.NET 3.5編譯。
如果我這樣做,
string test = System.Configuration.ConfigurationManager.AppSettings["test"];
我得到的消息「錯誤182的類型或命名空間名稱ConfigurationManager中System.Configuration‘'不存在命名空間存在’(是否缺少程序集引用? )'
任何想法?
已添加到System.Configuration參考? – richeym 2010-07-28 22:59:34
對。我以爲我有,但我引用'System'dll – peter 2010-07-28 23:00:43