Autor Beitrag
Orothred
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 86


C# (VS 2005)
BeitragVerfasst: Mi 12.09.07 12:47 
Ich bin gerade dabei einen Dienst zu schreiben, der Dateien auf veränderungen überwacht.

ich bekomme immer folgende fehlermeldung:

"The Name "Application" does not exist in the current context"

ich habe das programm nach einen beispielcode geschrieben und hab alles genauso gemacht wie da beschrieben. was kann ich machen?
bd.cole
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 46

Win XP, Vista
C# (VS 2005)
BeitragVerfasst: Mi 12.09.07 13:04 
Hi ein Stückchen Code wäre da nicht schlecht. Die Stelle an der er den Fehler anzeigt.
Orothred Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 86


C# (VS 2005)
BeitragVerfasst: Mi 12.09.07 13:12 
ausblenden Quelltext
1:
private string protocolFile = Application.StartupPath + "FileWatchLog.log";					


wenn mehr code benötigt wird einfach bescheid sagen ^^
bd.cole
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 46

Win XP, Vista
C# (VS 2005)
BeitragVerfasst: Mi 12.09.07 13:23 
Hast du ganz oben als using auch
ausblenden C#-Quelltext
1:
using System.Windows.Forms;					

?
Orothred Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 86


C# (VS 2005)
BeitragVerfasst: Mi 12.09.07 13:28 
ist nicht verfügbar bei dienstanwendungen, hab ich auch schon ausprobiert
JüTho
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2021
Erhaltene Danke: 6

Win XP Prof
C# 2.0 (#D für NET 2.0, dazu Firebird); früher Delphi 5 und Delphi 2005 Pro
BeitragVerfasst: Mi 12.09.07 13:41 
Das ist eben das Problem: Application gehört zu System.Windows.Forms und steht deshalb u.a. bei Konsolenanwendungen nicht zur Verfügung.

Vielleicht hilft Dir (bei Konsolenappl. klappt's):
ausblenden C#-Quelltext
1:
2:
3:
using System.Reflection;
...
Assembly.GetExecutingAssembly().Location

Gruß Jürgen