0

I am getting this error when I am adding 'using System.Timers' in visual studio 2013

using System.Timers;

Error:

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

Patrick Hofman
  • 153,850
  • 22
  • 249
  • 325
Robbin Singh
  • 55
  • 2
  • 6

3 Answers3

2

The System.Timers namespace is in the System.dll assembly.

Either you have accidentally removed the reference to System.dll, or you have created some other identifier named System that is interfering with your declaration.

Guffa
  • 687,336
  • 108
  • 737
  • 1,005
  • Why the downvote? If you don't explain what it is that you think is wrong, it can't improve the answer. – Guffa Jan 04 '15 at 16:51
  • using System; using System.Collections.Generic; using System.Timers; I have also used other namespaces and are working, the problem is only with Timers – Robbin Singh Jan 04 '15 at 16:57
  • @RobbinSingh: Then the only remaining explanation is that you are using a platform that isn't supposed to have system timers in the first place. – Guffa Jan 04 '15 at 17:09
2

Since you are not very sharing I created a test project. A PCL (Portable Class Library) project. I just took all platforms, including Silverlight 5.

When I add the using you are talking about, it indeed says the namespace doesn't exist. So it seems to be you have a project type that doesn't support System.Timers.

To support Guffa's assumption of removing the System assembly, indeed, that gives the exact same error message too.

Community
  • 1
  • 1
Patrick Hofman
  • 153,850
  • 22
  • 249
  • 325
0

Depending on your project you might need to add a reference to be able to import the namespace.

To do open your project explorer and rightclick "references" -> "add reference"

pbeedgen
  • 47
  • 1
  • 2