C#添加引用问题

sen*_*ale 2 c# selenium

我将selenium引用添加到项目中并且正常工作但是当我单击rebuild project时出现此错误:

Error 3   The type or namespace name 'Selenium' could not be found (are you
Run Code Online (Sandbox Code Playgroud)

缺少using指令或程序集引用?)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
Run Code Online (Sandbox Code Playgroud)

解决因为它依赖于"System.Web,Version = 4.0.0.0,Culture = neutral,PublicKeyToken = b03f5f7f11d50a3a",它不在当前目标框架".NETFramework,Version = v4.0,Profile = Client"中.请删除不在目标框架中的程序集的引用或考虑重新定位项目.NCrawler.WinDemo

什么可能是错的?

Mr.*_*tty 8

我猜这是因为你的项目正在使用客户端配置文件(框架版本中的"Profile = Client").尝试在项目属性中将目标框架设置为普通的旧".NET Framework 4",看看是否可以解决问题.

在这种情况下,Selenium程序集引用System.Web,不允许客户端配置文件框架.有关详细信息,请参阅http://msdn.microsoft.com/en-us/library/cc656912.aspx.