类型或命名空间名称“联合”;命名空间“System.ServiceModel”中不存在;更新到VS2010后

发布于 2024-08-29 22:23:40 字数 428 浏览 4 评论 0原文

将项目从 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

变身佩奇 2024-09-05 22:23:40

感谢下面的帖子,我通过添加 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

感悟人生的甜 2024-09-05 22:23:40

对我来说,结果是下面一行:

<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">

应该是

<assemblyBinding appliesTo="v2.0.50727" xmlns="urn:schemas-microsoft-com:asm.v1">

我的解决方案中有许多其他项目都基于相同的东西 - 不知道它是如何丢失的,但添加它解决了问题。

For me it turned out to be the following line:

<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">

it should have been

<assemblyBinding appliesTo="v2.0.50727" xmlns="urn:schemas-microsoft-com:asm.v1">

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.

断念 2024-09-05 22:23:40

尝试删除任何有问题的引用,然后重新添加它们并编译。是否也会发生同样的情况?

Try deleting any references in question and then re-adding them afresh and compile. Does the same happen?

感情洁癖 2024-09-05 22:23:40

如果您在 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.

夜司空 2024-09-05 22:23:40

记得过去有过类似的事情,我通过在 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文