System.Timers cannot be found.

System.Timers cannot be found.

Postby Conor » 26 Feb 2013, 13:00

Hello,

I'm trying to make a custom command with a timer in it, but I can't seem to get System.Timers to actually show its face.

I get this error when compiling:

Error #CS0234
Message: The type or namespace name 'Timers' does not exist in the namespace 'System' (are you missing an assembly reference?)
Line: 20

My code is:
Code: Select all
System.Timers.Timer freezeTimer = new System.Timers.Timer(1000);


Even when I try to add 'System.Timers' to the libraries, it doesn't show up... http://puu.sh/28Egm

I can use System.Timers in anything else I code, just not for a custom command for MCDzienny. How can I fix this? Or is this something to do with the compiler for MCDzienny's custom commands? :S
Conor (Conanza121)
User avatar
Conor
Coder
 
Posts: 390
Joined: 10 Oct 2012, 21:36
Location: @21Conor

Re: System.Timers cannot be found.

Postby toystory_justin » 26 Feb 2013, 14:16

About that picture, Conor, are u using VS express?
toystory_justin
 
Posts: 224
Joined: 11 Nov 2012, 07:12
Location: On a dark place

Re: System.Timers cannot be found.

Postby Conor » 26 Feb 2013, 14:21

toystory_justin wrote:About that picture, Conor, are u using VS express?


Microsoft Visual Studio Express 2012 (C#)

Its just an updated version of the 2010 one most people still use.

You can download the 2012 version here:

http://www.microsoft.com/visualstudio/e ... ws-desktop
Conor (Conanza121)
User avatar
Conor
Coder
 
Posts: 390
Joined: 10 Oct 2012, 21:36
Location: @21Conor

Re: System.Timers cannot be found.

Postby Conor » 06 Mar 2013, 01:50

*Bump*

Please help when you can Dzienny, I have finished a new command but a timer is necessary. I am getting the same errors when compiling :/

Error #CS0234
Message: The type or namespace name 'Timers' does not exist in the namespace 'System' (are you missing an assembly reference?)
Line: 554

-------------------------

Error #CS0234
Message: The type or namespace name 'Timers' does not exist in the namespace 'System' (are you missing an assembly reference?)
Line: 653


I can't add the System.Timers to the top of the code either, as it doesn't allow me, it isn't recognised.

I did some research and found that it could be something to do with the .NET framework MCDzienny targets and whether System.Timers would be supported, but I'm pretty sure it is meant to right? I mean you use them in the source code, I just don't know why it won't allow me to use them in custom commands.

Its probably something I'm doing wrong and nothing to do with MCDzienny lol, please help me Dzienny when you see this!!!
Conor (Conanza121)
User avatar
Conor
Coder
 
Posts: 390
Joined: 10 Oct 2012, 21:36
Location: @21Conor

Re: System.Timers cannot be found.

Postby Conor » 07 Mar 2013, 04:24

Since the compiler has been updated in v9.5.0.0, I can use System.Timers.

I am guessing that was the reason why?

Thank you Dzienny!
Conor (Conanza121)
User avatar
Conor
Coder
 
Posts: 390
Joined: 10 Oct 2012, 21:36
Location: @21Conor

Re: System.Timers cannot be found.

Postby dzienny » 08 Mar 2013, 01:10

You have been doing everything perfectly fine. The problem was in the compiler. It didn't reference some of the basic libraries. Now, it does, at least for Windows version. Unfortunately commands on Linux and Mac Os are still compiled without the additional references. There are some differences between Mono and CLR, and in case of this feature, it's probably required to write a different code for Mono.
User avatar
dzienny
Administrator
 
Posts: 1181
Joined: 23 Jan 2011, 14:27


Return to Help in Coding

Who is online

Users browsing this forum: No registered users and 5 guests

cron