简体   繁体   中英

Visual Studio 2010 Ultimate Can't Find the Stopwatch class

Visual Studio 2010 can't find the stopwatch class in any assembly.

Whenever I declare it in my code, VS gives an error saying that the type Stopwatch is not found. I checked that I am referencing the correct assembly (system) and that I am using the full .NET framework 4.0.

Does anyone know how to fix this problem?

开发基于Box2d的游戏时遇到了相同的问题。我通过添加“ Microsoft.Phone”引用来解决了该问题。希望该方法可以对您或遇到此问题的人有所帮助。

Usually when something like that happens it's because you have installed some beta version of a library (or a new beta version of .NET Framework). Anyway which language are you using?

(I assume you checked System.dll is referenced and you're not targeting/referencing the CF)

Should be in System.dll, no? I would verify that your references are including System.dll (ah, you say you have), and then try and explicitly reference it in your code as System.Diagnostics.Stopwatch and see if it resolves.

I would also verify the path to your referenced System.dll and ensure you're picking up the right one, and perhaps use ILSpy or Reflector to dig into the DLL and ensure it's there.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM