简体   繁体   English

System.ServiceModel缺失

[英]System.ServiceModel missing

I'm working with VS2010 express on Win7 (64 bit) and I'm trying use System.ServiceModel but I get an error that there is no ServiceModel in the System namespace: 我在Win7(64位)上使用VS2010 express,我正在尝试使用System.ServiceModel但是我收到一个错误,即System命名空间中没有ServiceModel

The type or namespace name 'ServiceModel' does not exist in the namespace 'System' (are you missing an assembly reference?) 命名空间“System”中不存在类型或命名空间名称“ServiceModel”(您是否缺少程序集引用?)

I looked in \\Windows\\Microsoft.NET\\Framework\\v4.0.30319 and there are some ServiceModel___.dll files but I don't know if I'm missing something or if they are corrupted. 我查看了\\Windows\\Microsoft.NET\\Framework\\v4.0.30319并且有一些ServiceModel___.dll文件,但我不知道我是否遗漏了某些东西或者它们是否已损坏。

Any advice? 有什么建议?

Thanks, Yonatan 谢谢,Yonatan

Add a reference to the assembly System.ServiceModel. 添加对程序集System.ServiceModel的引用。 Select Project -> Add Reference and then select the assembly name. 选择Project - > Add Reference ,然后选择程序集名称。

右键单击Project - > Properties - > Application - > Target Framework = .NET Framework 4.5

The System.ServiceModel namespace is in System.ServiceModel.dll. System.ServiceModel命名空间位于System.ServiceModel.dll中。

I'm not running 64 bit Windows so I can't check whether that's the right location. 我没有运行64位Windows,所以我无法检查这是否是正确的位置。

Sometimes Visual Studio doesn't install this dll in GAC. 有时,Visual Studio不会在GAC中安装此dll。
You can gac what is located in %systemDrive%\\Windows\\Microsoft.NET\\Framework\\v4.0.30319 using gacutil /i dll_file 您可以使用gacutil /i dll_file gac位于%systemDrive%\\ Windows \\ Microsoft.NET \\ Framework \\ v4.0.30319中的gacutil /i dll_file
To use gacutil you can open Command Prompt from Visual Studio Tools menu. 要使用gacutil,您可以从Visual Studio工具菜单中打开命令提示符。

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

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