简体   繁体   English

C#添加引用问题

[英]C# adding reference problem

I add selenium reference to the project and work ok but when i click rebuild project i get this error: 我将selenium引用添加到项目中并且正常工作但是当我单击rebuild project时出现此错误:

 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 缺少using指令或程序集引用?)D:\\ PROJEKTI \\ crawler \\ WebCrawlerSuite \\ NCrawler \\ Net 4.0 \\ NCrawler.WinDemo \\ SeleniumHtmlDocumentProcessor.cs 6 7 NCrawler.WinDemo

and this warning: 这个警告:

 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". 解决因为它依赖于“System.Web,Version = 4.0.0.0,Culture = neutral,PublicKeyToken = b03f5f7f11d50a3a”,它不在当前目标框架“.NETFramework,Version = v4.0,Profile = Client”中。 Please remove references to assemblies not in the targeted framework or consider retargeting your project. 请删除不在目标框架中的程序集的引用或考虑重新定位项目。 NCrawler.WinDemo NCrawler.WinDemo

what can be wrong? 什么可能是错的?

I'm guessing this is because your project is using the Client Profile ("Profile=Client" in the framework version). 我猜这是因为你的项目正在使用客户端配置文件(框架版本中的“Profile = Client”)。 Try setting the target framework to plain old ".NET Framework 4" in your project properties and see if that does the trick. 尝试在项目属性中将目标框架设置为普通的旧“.NET Framework 4”,看看是否可以解决问题。

In this case, the Selenium assembly is referencing System.Web, which is not allowed for the Client profile framework. 在这种情况下,Selenium程序集引用System.Web,不允许客户端配置文件框架。 See http://msdn.microsoft.com/en-us/library/cc656912.aspx for details. 有关详细信息,请参阅http://msdn.microsoft.com/en-us/library/cc656912.aspx

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM