System.ServiceModel missing

C#Namespaces

C# Problem Overview


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:

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

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.

Any advice?

Thanks, Yonatan

C# Solutions


Solution 1 - C#

Add a reference to the assembly System.ServiceModel. Select Project-> Add Reference and then select the assembly name.

Solution 2 - C#

Right click on Project -> Properties -> Application -> Target Framework = .NET Framework 4.5

Solution 3 - C#

The System.ServiceModel namespace is in System.ServiceModel.dll.

I'm not running 64 bit Windows so I can't check whether that's the right location.

Solution 4 - C#

Sometimes Visual Studio doesn't install this dll in GAC.
You can gac what is located in %systemDrive%\Windows\Microsoft.NET\Framework\v4.0.30319 using gacutil /i dll_file
To use gacutil you can open Command Prompt from Visual Studio Tools menu.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionYonatan KView Question on Stackoverflow
Solution 1 - C#Mamta DView Answer on Stackoverflow
Solution 2 - C#leviosView Answer on Stackoverflow
Solution 3 - C#ChrisFView Answer on Stackoverflow
Solution 4 - C#MarcoView Answer on Stackoverflow