2011-06-23 48 views

回答

10

嘗試在ConfigurationElementType之後添加關鍵字屬性。這不是必需的,但這可能會讓你得到一個更有用的錯誤信息......我的猜測是你缺少引用......這總是EntLib的問題。

+1

哇,非常感謝。這確實解決了這個問題。奇怪的是,所有的資源(包括msdn)如何使用ConfigurationElementType而不是ConfigurationElementTypeAttribute。 –

5

一定要在項目添加引用.Net選項卡下將對System.ComponentModel.Compostion或Sytem.ComponentModel.DataAnnotations的引用添加到您的項目。

然後你應該可以包含'using System.ComponentModel;'在你的項目中讓你的屬性正常工作。

+1

將System.ComponentModel.Compostion添加到爲我工作的引用。 –

+0

添加system.Web.mvc爲我工作 –

0

將Enterprise Library Shared Library程序集添加到爲我工作的項目的引用中。然後,你可以添加使用Microsoft.Practices.EnterpriseLibrary.Common.Configuration;