Search code examples
c#xnastopwatch

Won't let me use the class Stopwatch. in visual studio


I was trying to get farseer physics engine to work. Everything compiles fine except for one error that wont go away.

Error 1 The type or namespace name 'Stopwatch' could not be found (are you missing a using directive or an assembly reference?)

It wont let me contruct a Stopwatch object. The error is point at this one line private Stopwatch _watch = new Stopwatch(); Now i checked the references and I can find the stopwatch class in system.diagnostics, so I know its there, and I'm using System, I also put in System.diagnostics. Any help on what I can do to get it to find the Stopwatch class. I'm new to visual studio and xna, but I have prog exp w/ java.

EDIT: I added the reference Microsoft.Phone like v4vendetta said and it worked, Thanks!


Solution

  • I believe you would need a reference to Microsoft.Phone.

    Never worked on them but got a hint from the following post which lead to my suggestion.

    Apparently this guy was unable to reference it.