System.Xml.Linq.XDocument'在未引用的程序集中定义
我有一个解决方案,其中包含几个项目,一个是网络服务,其他是类库。我想在 Web 服务和类库之一中使用 Xdocuments,因此我在解决方案资源管理器中添加了对 System.xml.Linq 的引用,并使用 System.Xml.Linq 将其包含在相关的 .cs 文件中。这也在 web.config 中引用,如下所示:
<add assembly="System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
位于程序集标记中。
但是,当我向服务发出请求时,我在它进入服务之前就收到了下面的响应。问题在于类库中的引用,因为我已将其取出来进行测试。我不确定出了什么问题。有人可以帮忙吗?
The type 'System.Xml.Linq.XDocument' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.
提前致谢。
I have a solution which contains a few projects, one being a web sevrice, the others being class libraries. I want to use Xdocuments in both the web service and one of the class libraries, so i have added a reference to System.xml.Linq in solution explorer, and included it within the relevant .cs files by using System.Xml.Linq. This is also reference in the web.config as follows:
<add assembly="System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
Which is in the assemblies tag.
But when i fire a request at the service i get the response below before it even gets into the service. The problem is with the having the reference in the class library, as i have taken it out to test. I am not sure what is wrong. Can anyone please help??
The type 'System.Xml.Linq.XDocument' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.
Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在这种情况下,我的第一个想法是检查项目中的目标框架是否设置正确。为此,请在解决方案资源管理器中右键单击您的项目,选择属性并验证应用程序选项卡上的目标框架设置。
My first idea would be in this case to check if target framework is set correctly in the projects. To do this right click Your projects in Solution explorer, select properties and verify the target framework setting on the application tab.