我試圖使用ConfigurationManager,起初System.Configuration
沒有它,我想知道爲什麼。爲什麼沒有ConfigurationManager?
一些嘗試後,經過包括參考System.Configuration
現在表現出來。
因此,如何我可以使用System.Configuration
沒有參考?但需要參考使用System.Configuration.ConfigurationManager
我試圖使用ConfigurationManager,起初System.Configuration
沒有它,我想知道爲什麼。爲什麼沒有ConfigurationManager?
一些嘗試後,經過包括參考System.Configuration
現在表現出來。
因此,如何我可以使用System.Configuration
沒有參考?但需要參考使用System.Configuration.ConfigurationManager
在原有System.Configuration
名稱空間分開。 net1.0和1.1的命名空間System.Configuration在System.dll
之下。
由於.net2.0有一個新的程序集 - System.Configuration.dll
。
回到當天我們不得不使用ConfigurationSettings,這是在System.dll
大會,現在已經過時了。
現在,我們使用ConfigurationManager及其在System.Configuration.dll
程序集中。
因此,您得到System.Configuration
的原因可能是因爲您引用了System.dll
,它在默認情況下包含在winforms應用程序中。
任何組件可導出任何命名空間。
MyFoo.dll可以命名空間如System.Configuration.VeryImportant.Type
,這意味着,如果引用MyFoo.dll System.Configuration
是一個有效的命名空間中定義的類型,即使ConfigurationManager
類型在System.Configuration.dll
組件內限定。
默認情況下還包括其他程序集,其中可能包括System.Configuation
作爲導出的名稱空間。
這是因爲命名空間跨幾個組件
您可能已經獲得從mscorlib.dll程序集,或類似的核心DLL
這是什麼類型的項目?你的目標是什麼框架版本?你確定你的參考文獻是拼寫完善嗎? – maccettura
在多個程序集中可能有相同的名稱空間。 –
你是如何添加該參考的?奇怪的是它是'System.configuration'而不是'System.Configuration'。 – mason