C# FAQ 2.5 - How do I build a C# application using Visual Studio 2005 ("Whidbey")?

Visual Studio 2005 ("Whidbey") is the next edition of Visual Studio .NET. Alpha versions of it have been released at conferences and road shows around the country. The most recent release at the time of this article's writing is the "Community Technology Preview March 2004".

While these releases have been made available, they are not final products. Microsoft will add more enhancements and features to this product by collecting feedback from testers.

This FAQ delivers a sneak preview of the new and powerful development tool. You will build a simple application that accepts user input and prints the same on to the console. This simple application will a feel for Visual C# 2005 ("Whidbey").

Where can I get Visual Studio 2005 ("Whidbey?")

Microsoft has been giving out copies of this product (bits) at a number of conferences and road shows including the PDC 2003 and VSLive!. Alternatively, if you have subscribed to MSDN Universal Subscription, you can request a copy of the PDC kit from your local MSDN Customer Service center.

Building a Visual Studio 2005 Application

First, you have to launch Visual Studio 2005 ("Whidbey") (Start | All Programs | Microsoft Visual Studio Whidbey | Microsoft Visual Studio codename Whidbey).

You will be presented with a startup page. Select New Project from the File menu and choose Console Application from the Templates section. Be sure to select Visual C# from the Project Types area (See Figure 2.5.1)

Figure 2.5.1: Visual C# Project Types

Visual Studio 2005 ("Whidbey") will automatically create a template for a console C# application, as in Visual Studio .NET 2003.

For our sample applicationy, you should delete the three comment statements below the Main() method and enter the code given in listing 2.5.1:

Listing 2.5.1

string x;
Console.WriteLine("Enter your name"); x = Console.ReadLine(); Console.WriteLine("Hello {0}",x); Console.WriteLine("Press any key to exit"); Console.Read();

As you can see, this is a simple C# console program to prompt for a name and respond to it. The first line declares a variable named x of a data type string. The prompts is then presented asking for a name to be entered. It reads the name using the ReadLine() method and prints it on the console.

With the coding done, the next step is to compile and execute the program by pressing either the F5 key or by selecting the Start option on the Debug menu. The final output will be like as shown in Figure 2.5.2

Figure 2.5.2: Output from simple console program

If you exit the project now, the IDE will ask you whether or not to save the project. Enter a desired project name and save the project to a location. You also can choose not to save the project by selecting the Discard option. If you would like to modify the program code, select the Cancel option so that you will be returned to the code editor.

Note that the above steps might differ when Microsoft releases the beta and final versions of this product later this year.



About the Author

Anand Narayanaswamy

Anand Narayanaswamy (Microsoft MVP) is a freelance writer for Developer.com and Codeguru.com. He works as an independent consultant and runs NetAns Technologies (http://www.netans.com)which provides affordable web hosting services. He is the author of Community Server Quickly (http://www.packtpub.com/community-server/book). Anand also runs LearnXpress.com (http://www.learnXpress.com) and Dotnetalbum.com (http://www.dotnetalbum.com) and regularly contributes product and book reviews for various websites. He can be reached at ananddotnet@yahoo.co.in

Comments

  • How is this useful????

    Posted by keeg_hexor on 05/16/2004 08:26am

    I can't understand how this would be useful to anyone. I mean... what is this?? "...execute the program by pressing either the F5 key". "...the IDE will ask you whether or not to save the project". "also can choose not to save the project by selecting the Discard option". I understand that u have taken some time to compile this article, but people comming here definately know how to open and compile a simple project. And one more thing... how is this procedure different from the usual method? My $0.02

    • How is this useful????

      Posted by Brad Jones on 09/21/2006 04:42pm

      This FAQ article was written with the newbie in mind, not the experienced "Code Guru"

      Reply
    Reply
Leave a Comment
  • Your email address will not be published. All fields are required.

Top White Papers and Webcasts

  • Wednesday, September 24, 2014 8:00 AM - 9:00 AM PDT According to a recent Forrester Research report, many companies are choosing low-code platforms over traditional programming platforms, due to the speed with which low-code apps can be assembled and tested. With customer-facing applications on the rise, traditional programming platforms simply can't keep up with the "short schedules and rapid change cycles" required to develop these applications. Check out this upcoming webinar and join Clay Richardson from …

  • Live Event Date: September 10, 2014 @ 11:00 a.m. ET / 8:00 a.m. PT Modern mobile applications connect systems-of-engagement (mobile apps) with systems-of-record (traditional IT) to deliver new and innovative business value. But the lifecycle for development of mobile apps is also new and different. Emerging trends in mobile development call for faster delivery of incremental features, coupled with feedback from the users of the app "in the wild". This loop of continuous delivery and continuous feedback is …

Most Popular Programming Stories

More for Developers

Latest Developer Headlines

RSS Feeds