2011-02-18 56 views
2

我添加硒參照項目和好的工作,但是當我點擊重建項目中,我得到這個錯誤:C#添加引用問題

Error 3 The type or namespace name 'Selenium' could not be found (are you 

missing a using directive or an assembly reference?) D:\PROJEKTI\crawler\WebCrawlerSuite\NCrawler\Net 4.0\NCrawler.WinDemo\SeleniumHtmlDocumentProcessor.cs 6 7 NCrawler.WinDemo

和這樣的警告:

Warning 2 The referenced assembly "ThoughtWorks.Selenium.Core" could not 

be resolved because it has a dependency on "System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" which is not in the currently targeted framework ".NETFramework,Version=v4.0,Profile=Client". Please remove references to assemblies not in the targeted framework or consider retargeting your project. NCrawler.WinDemo

什麼可以是錯誤的?

回答

8

我猜這是因爲您的項目正在使用客戶端配置文件(框架版本中的「配置文件=客戶端」)。嘗試在你的項目屬性中將目標框架設置爲普通的「.NET Framework 4」,然後看看它是否有用。

在這種情況下,Selenium程序集引用System.Web,而客戶端配置文件框架不允許該程序集。詳情請參閱http://msdn.microsoft.com/en-us/library/cc656912.aspx