【问题标题】:'ServiceModel' does not exist in namespace 'System'. When I try to add a reference, it says it's already referenced命名空间“系统”中不存在“服务模型”。当我尝试添加引用时,它说它已被引用
【发布时间】:2014-07-06 21:27:43
【问题描述】:

我正在使用 Visual Studio Professional 2013,我正在尝试导入其文件位于 SVN 上的 ASP.NET 网站,以便我可以在本地运行和调试该网站。我创建了一个新网站并将目标框架更改为 .NET 3.5(这就是构建网站的人告诉我的内容)。因此,我将文件复制到网站目录,并使用“添加->现有网站”将它们添加到解决方案中。

我特别收到此错误:

The type or namespace name 'ServiceModel' does not exist in the namespace 'System' (are you missing an assembly reference?)

所以,我想,我只是添加一个对 ServiceModel 的引用,没什么大不了的。所以,我右键项目,去添加引用,在Assemblies->Framework下查找System.ServiceModel,勾选,点击ok。然后会发生这种情况:

The Web site is already referencing the assembly 'System.ServiceModel'.

这些事情可能会有所帮助:

  • 我的目标框架不是“客户端配置文件”。我在 VS2013 中没有该选项
  • 当我创建一个新的网站项目并添加一个基本类文件时,我可以使用 System.ServiceModel 命名空间,因为它已经被引用。
  • 当我在“项目引用”的类视图中查看时,我没有看到 System.ServiceModel。在上面的“新网站项目”中,我确实看到了 Class View 下的 System.ServiceModel。

【问题讨论】:

  • 你解决过这个问题吗?我遇到了类似的问题。

标签: c# asp.net .net-3.5 visual-studio-2013


【解决方案1】:

添加对程序集 System.ServiceModel 的引用。选择项目-> 添加引用,然后选择程序集名称。

【讨论】:

  • 我的项目中已经引用了 System.ServiceModel -- 我必须删除并重新添加它。
  • 我不得不关闭 VS 并重新启动它
【解决方案2】:

将 System.ServiceModel.dll 从“C:\Windows\Microsoft.NET\Framework\v4.0.30319”复制到项目 bin 文件夹。

【讨论】:

  • 当我添加到调试文件夹时为我工作。谢谢!
【解决方案3】:
  • 删除服务参考
  • 卸载项目
  • 删除<RootNamespace>MyProject</RootNamespace>
  • 重新加载项目
  • 重新添加服务参考
  • 构建

【讨论】:

    猜你喜欢
    • 2014-10-13
    • 2017-12-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-03-08
    • 1970-01-01
    • 2020-12-24
    • 1970-01-01
    相关资源
    最近更新 更多