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


  • 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"

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

Top White Papers and Webcasts

  • On-demand EventEvent Date: March 21, 2017 With the rise in ransomware attacks, bank heists that reached new levels of sophistication, and extortion plots that were beyond anything we could have imagined, 2016 certainly was an eventful year for cybersecurity. Going into 2017, no business can afford to be uninformed about cybersecurity or unprepared for an attack. Watch this informative webinar, presented by Andrey Pozhogin, Senior B2B Product Marketing Manager at Kaspersky Lab, as he examines predictions for …

  • Microsoft® Office 365 is a top choice for enterprises that want a cloud–based suite of productivity collaboration applications. With Office 365, you get access to Microsoft™ Office solutions practically anytime, anywhere, on virtually any device. It's a great option for current Microsoft users who can now build on their experience with Microsoft™ solutions while enjoying the flexibility of a cloud-based delivery. But even organizations with no previous investment in Microsoft will find that …

Most Popular Programming Stories

More for Developers

RSS Feeds

Thanks for your registration, follow us on our social networks to keep up-to-date