Search code examples
c#visual-studio-2019.net-4.5

C# Namespace 'ServiceModel' does not exist in namespace 'System'


I have been searching the forum for answers to my problem but unfortunately the proposed solutions have not worked for me. I have a project (Classes library .NET Framework) with the reference to the System.ServiceModel assembly added. In fact, if that reference the code fails. I add an image where you can see the added reference:

enter image description here

Now, I want to catch the FaultException exception and when I add:

using System.ServiceModel;

I can't compile and I get the error:

Namespace 'ServiceModel' does not exist in namespace 'System'.

Just in case I deleted the reference and added it again but the problem persists. I must be missing something but I can't figure out what it could be. Could someone help me? I'm using Visual Studio 2019. Thank you very much!


Solution

  • Unfortunately I didn't see the problem @Damien_The_Unbeliever commented on. Adding the reference in the other project solved my problem!