2011-02-18 50 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