0

in Java, you can write:

public static void Main(String[] args) { }

and than "right click" => "run as" => "Java application" and it will run the current Main Method.

Any chance to have that in Visual Web Developer?

Thanks

SexyMF
  • 10,657
  • 33
  • 102
  • 206

2 Answers2

4

Visual Web Developer is presumably for web applications. Web applications don't run in that sort of way - they respond to web requests.

The equivalent of a main method (note case) in Java is a Main method in C#, in one of the following forms:

static void Main(string[] args)
static void Main()
static int Main(string[] args)
static int Main()

The method can have any accessibility, can return int or void, and either be parameterless or take an array of strings.

That will work fine when creating a console or Windows application - but not a web application. If you want to write desktop applications, use Visual C# Express or something similar.

Jon Skeet
  • 1,421,763
  • 867
  • 9,128
  • 9,194
  • So Do you have any idea Y can't I create a command line project in c# inside the VWD for testing? thanks – SexyMF Sep 20 '11 at 08:51
  • 2
    @SexyMF: The clue is in the name: *Visual Web Developer*. It's for developing *web* applications. Just install Visual C# Express as well. – Jon Skeet Sep 20 '11 at 08:54
  • Yes, but I cannot run functions from visual c# express that are located in VWD... – SexyMF Sep 20 '11 at 09:37
  • @SexyMF: You should be able to create a class library and use that from both environments. Ultimately, if you want to do everything you should probably just buy Visual Studio... – Jon Skeet Sep 20 '11 at 09:38
  • @SexyMF: Yes, within VS you can create all kinds of projects. Whether you can add a reference from a console app to code in a web app, I'm not sure... – Jon Skeet Sep 20 '11 at 10:00
2

No there isn't. Architecture of web-app is somewhat different then desktop or standalone applications.

KV Prajapati
  • 93,659
  • 19
  • 148
  • 186