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

11,013

Solution 1

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

Solution 2

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

Share:
11,013
Mark Kurkowski
Author by

Mark Kurkowski

Updated on June 20, 2022

Comments

  • Mark Kurkowski
    Mark Kurkowski almost 2 years

    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.