Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

'ServiceModel' does not exist in namespace 'System'. When I try to add a reference, it says it's already referenced

I'm using Visual Studio Professional 2013, and I'm trying to import an ASP.NET web site whose files were on SVN so that I can run and debug the website locally. I created a new web site and changed the target framework to .NET 3.5 (that's what the guys who built the website told me it was in). So, I copied over the files to the website directory, and added them into the solution using "add->existing web site".

I get this error specifically:

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

So, I think to myself, I'll just add a reference to ServiceModel, no big deal. So, I right-click the project, go to add reference, look for System.ServiceModel under Assemblies->Framework, check it, and click ok. Then this happens:

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

These things might help:

  • My target framework is not "Client Profile". That option isn't available to me in VS2013
  • When I make a new web site project and just add a basic class file, I can use the System.ServiceModel namespace because it's already referenced.
  • When I look in Class View at "Project References", I don't see System.ServiceModel. In the above "new website project", I DO see System.ServiceModel under Class View.
like image 234
Mark Kurkowski Avatar asked May 19 '14 02:05

Mark Kurkowski


2 Answers

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

like image 154
Abdeloihab Bourassi Avatar answered Oct 23 '22 17:10

Abdeloihab Bourassi


Copy System.ServiceModel.dll from "C:\Windows\Microsoft.NET\Framework\v4.0.30319" to project bin folder.

like image 43
asimolmez Avatar answered Oct 23 '22 17:10

asimolmez