C Sharp/Introduction to Visual Studio IDE

From Meshplex

Jump to: navigation, search

'Bold text== Introduction: ==


With Visual Studio .Net, developers can build desktop applications, web applications, design tables and views on the SQL Server Desktop engine, XML Web services and application targeting handheld devices. Developers get to share a familiar IDE and program in languages they already know. With Visual Studio .Net, Development cycle times are reduced significantly because of the various pre-built wizards for programming and components. With its powerful editor for Web designs, HTML IntelliSense and Style Sheet Editor, Visual Studio.Net makes it simple for developers to create solutions spanning any Internet device.

Some Important Visual Studio .Net features:

	Single IDE for all Languages             
    o	Visual C# .NET
    o	Visual Basic .NET
    o	Visual C++ .NET
    o	Visual J# 
 •	Common Forms Editor
    o	VB.NET, C++, and C#
 •	HTML/XML Editors
 •	Macros/Macro Explorer
 •	Tabbed Documents
 •	Integrated IE Browser
 •	Solution Explorer
 •	Dynamic Help
 •	Server Explorer
   o	SQL Databases, Data Connections, Etc.
   o	Event Viewer, Message Queues, Services

[edit] Overview

Visual Studio .NET is Microsoft's big successful step towards integrating the Microsoft development environments into one single Integrated Development Environment (IDE). All .NET languages share the same VS.NET IDE. The advantage of having a unified IDE for all .NET languages is that the learning cycle involving learning new languages is considerably reduced. To build, debug, and deploy applications also becomes very easy to learn and implement. Another big step is integration of Microsoft Visual Interdev features into Visual Studio .NET. This provides the way where all .NET languages have support and access to Internet functionality.


[edit] Working with C# using command line tools.

There may be some cases that one does not have full version of the Visual Studio .NET available. But a programmer can develop and compile the C# source code without Visual Studio .NET IDE also. C# code can be written using any free text editor like Notepad. C# source code then can be compiled using the stand-alone complier “csc.exe” (C Sharp complier), provided with the Microsoft .net SDK. Microsoft .net SDK is freely downloadable. Entire application can be complied or build using the C Sharp Complier (csc.exe).

Configuring the system:

Before we start using the command line tool ‘csc.exe’, we may need to do some configuration of the machine where the code development will be done. Although when Microsoft .NET SDK is installed, the path of the csc.exe should be set automatically under system environment variables. But in some cases, when it is not set automatically, then we need to set the path manually. Otherwise every time we need to compile the code, we always need to navigate to containing directory of csc.exe, which looks cumbersome when we are using command line tools.

Setting the environment variable path manually (Windows XP/2K/NT):

   1.	Navigate to the ‘My Computer’ icon (usually placed on desktop or under Start -> programs).
   2.	Right click on the ‘My Computer’ icon to open the pop-up menu and choose properties.
   3.	Click on the Advanced Tab.
   4.	Now click on the Environment variable button.
   5.	Under system variable, select the path variable and click EDIT button.
   6.	Add .NET framework path to existing path list. (Do not overwrite whole string)

For E.g. C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727 7. Click OK three times.

Test run of C Sharp Complier: 1. Navigate and click Start -> Run. 2. Type Cmd and click OK button. 3. On command editor, type csc -? and Hit Enter.


Supported options related to the C# Compiler should be listed here.


Building a C# test application using text editor and compiling using CSC.exe:

Steps:

1. Open some text editor like Notepad.

2. Let’s write some sample code which flashes “Hello World”.

 //C# application using text editor
 using System;
 class hello
 {
   public static void Main()
   {
      Console.WriteLine("Hello World");
   }
 }

3. Save the file as hello.cs

4. Navigate and click Start -> Run.

5. Type Cmd and click OK button.

6. On command editor, type csc hello.cs and Hit Enter.

The output will be:

 C:\>csc helloworld.cs
 Microsoft (R) Visual C# 2005 Compiler version 8.00.50727.42
 for Microsoft (R) Windows (R) 2005 Framework version 2.0.50727
 Copyright (C) Microsoft Corporation 2001-2005. All rights reserved.

7. You will see a helloworld.exe in your current directory. Type:

 C:\helloworld
 Hello World
Personal tools