类型或命名空间名称“联合”;命名空间“System.ServiceModel”中不存在;更新到VS2010后
将项目从 vs2008 更新到 vs2010 后尝试编译我的 asp.net 站点时出现以下错误
命名空间“System.ServiceModel”中不存在类型或命名空间名称“联合”(您是否缺少程序集引用?)
我有一个针对 3.5 框架的 asp.net 网站(就像在 vs2008 中那样) 我还添加了对 System.ServiceModel.Web 的引用,
我的类顶部也有这些 using 语句: 使用 System.ServiceModel; 使用 System.ServiceModel.Description; 使用 System.ServiceModel.Syndicate; 使用 System.ServiceModel.Web;
最后两个抱怨上面的错误,将它们注释掉会产生错误(找不到 WebGet 等),就像触发器一样。
有人有什么想法吗?
i get the following error when trying to compile my asp.net site after updating the project from vs2008 to vs2010
The type or namespace name 'Syndication' does not exist in the namespace 'System.ServiceModel' (are you missing an assembly reference?)
I have the asp.net site targeting 3.5 framework (as it did in vs2008)
I also added a reference to System.ServiceModel.Web
I also have these using statements at the top of my class:
using System.ServiceModel;
using System.ServiceModel.Description;
using System.ServiceModel.Syndication;
using System.ServiceModel.Web;
The last 2 complain with the error above, commenting them out produces errors (cannot find WebGet, etc.) like it flipflops.
Anyone have any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
感谢下面的帖子,我通过添加 Web DLL 在 .NET 3.5 中实现了此功能。
DOTNET 3.5:添加对 System.ServiceModel.Web.dll 的引用
DOTNET 4.0:添加对 System.ServiceModel.dll 的引用
StackOverflow 帖子
I got this working in .NET 3.5 by adding the Web DLL, thanks to the post below.
DOTNET 3.5: add a reference to the System.ServiceModel.Web.dll
DOTNET 4.0: add a reference to the System.ServiceModel.dll
StackOverflow Post
对我来说,结果是下面一行:
应该是
我的解决方案中有许多其他项目都基于相同的东西 - 不知道它是如何丢失的,但添加它解决了问题。
For me it turned out to be the following line:
it should have been
I had many other projects in the solutions all based off the same thing - no idea how that went missing but adding it in solved the problem.
尝试删除任何有问题的引用,然后重新添加它们并编译。是否也会发生同样的情况?
Try deleting any references in question and then re-adding them afresh and compile. Does the same happen?
如果您在 Visual Studio 2010 中遇到此问题,我发现清理您的解决方案、关闭 Visual Studio 并重新启动它可以解决智能感知问题。
If you get this in Visual Studio 2010, I found cleaning your solution, closing Visual Studio and restarting it solved the intellisense issue.
记得过去有过类似的事情,我通过在 2、3、3.5 之间不断更改目标来修复它,直到它起作用 - 是的,你没听错。我的猜测是,从一个版本到下一个版本需要一两次时间才能自我修复配置文件。
remembered a kinda similar thing in the past, i fixed it by continuously changing the target between 2,3,3.5 until it worked - yes you heard me right. My guess is it took a time or two from one version to the next for it to self-fix the config file.