• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 321
  • Last Modified:

Using System.Net

Using System.Net isn't working...

C# VS 2010

I get a "are you missing an assembly reference" error.

What am I missing?
0
Sheldon Livingston
Asked:
Sheldon Livingston
  • 3
  • 2
  • 2
  • +1
1 Solution
 
Jacques Bourgeois (James Burger)PresidentCommented:
Could you give us the exact error message that you are receiving. There is nothing called System.net. There are the system namespace and system.dll, but it is the first time I see System.Net.

A message like this one might appear however if the reference to the System.dll was removed from the project. If this is so, go to the References tab of the project's properties (Project menu) and click the Add button to add a reference to System.dll. Do the same for any assembly for which you would get that message.
0
 
sameer_goyalCommented:
Well, there sure is System.Net namespace. It is primarily used when working with windows/desktop applications.

The error you mention can only occur if the reference to System.dll is somehow missing from your project.

Try adding the reference to System.dll and try again. You should be all set.
0
 
käµfm³d 👽Commented:
It would be better to know the specific class you are attempting to use. The System.Net namespace actually occurs within multiple assemblies.
0
Cloud Class® Course: Microsoft Exchange Server

The MCTS: Microsoft Exchange Server 2010 certification validates your skills in supporting the maintenance and administration of the Exchange servers in an enterprise environment. Learn everything you need to know with this course.

 
sameer_goyalCommented:
kaufmed:

I don't agree to 'The System.Net namespace actually occurs within multiple assemblies.'

If what you say is correct, then it defeats the whole purpose of having namespaces in .net

when you say, System.Net, that can be only 1 and it is only available under System.dll assembly.

Can you provide names of some other assemblies where System.Net is present?
0
 
käµfm³d 👽Commented:
If what you say is correct, then it defeats the whole purpose of having namespaces in .net
It assuredly does not. Worst case:  it means you have to fully-qualify your declarations.

Per your request, please see the decompiled versions of System.dll and System.Net.dll in the attached screenshot.

Screenshot
0
 
Jacques Bourgeois (James Burger)PresidentCommented:
I stand corrected, there is indeed a System.Net namespace. But from what I see, it contains the basic classes for web and network communications (cookies, http, upload and download).

Since my work is in Windows applications and databases, I never had use for that namespace and never encoutered it. I was on the impression that it had been confused with the System namespace that is at the root of most of the framework.

Sorry if my comment could have caused confusion.

As for the discussion about a namespace that exists along many assemblies, kaufmed is right. Although it is not common, it happens for a few namespaces. The purpose of a namespace is not to reference a dll, it is to have a way to more easily find a class and to differentiate between 2 classes with the same name.
0
 
Sheldon LivingstonConsultantAuthor Commented:
I was missing the ref to System.dll

Thank you
0
 
käµfm³d 👽Commented:
The purpose of a namespace is not to reference a dll, it is to have a way to more easily find a class and to differentiate between 2 classes with the same name.
I'd probably phrase that as, "the purpose of namespaces is to avoid naming conflicts. Two different classes can have the same name so long as each exists in its own namespace."

= )
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: SQL Server Core 2016

This course will introduce you to SQL Server Core 2016, as well as teach you about SSMS, data tools, installation, server configuration, using Management Studio, and writing and executing queries.

  • 3
  • 2
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now