Introduction to Visual Studio
Advanced Computer
Programming
McGraw-Hill Technology Education
Copyright © 2006 by The McGraw-Hill Companies, Inc. All rights reserved.
Visual Studio 2005
• Microsoft Visual Studio is an Integrated Development Environment
(IDE) from Microsoft.
It can be used to develop console and Graphical user interface
•applications
along with Windows Forms applications, web sites, web
applications, and web services in both native code together with
managed code for all platforms supported by Microsoft Windows,
Windows Mobile, Windows CE, .NET Framework, .NET Compact
Framework and Microsoft Silverlight.
13A-2
Visual Studio 2005
• It allows plug-ins to be added that enhance the functionality at
almost every level - including adding support for source control
systems (like Subversion and Visual SourceSafe) to adding new
toolsets like editors and visual designers for domain-specific
languages or toolsets for other aspects of the software development
lifecycle (like the Team Foundation Server client; Team Explorer).
13A-3
Visual Studio 2005
• Visual Studio supports languages by means of language services,
which allow any programming language to be supported (to varying
degrees) by the code editor and debugger, provided a languagespecific service has been authored. Built-in languages include C/C++
(via Visual C++), VB.NET (via Visual Basic .NET), and C# (via Visual
C#).
13A-4
Visual Studio 2005
• Support for other languages such as Chrome, F#, Python, and Ruby
among others has been made available via language services which
are to be installed separately. It also supports XML/XSLT,
HTML/XHTML, JavaScript and CSS.
Language-specific versions of Visual Studio also exist which provide
•more
limited language services to the user.
individual packages are called Microsoft Visual Basic, Visual
•J#,These
Visual C#, and Visual C++.
13A-5
Visual Studio 2005
• Currently, Visual Studio 2005 Professional Editions, along with
language-specific versions (Visual Basic, C++, C#, J#) of Visual Studio
2005 are available to students as downloads free of charge via
Microsoft's DreamSpark program. Visual Studio 2010 is currently in
development.
13A-6
Visual Studio 2005
• Support for programming languages is added by using a specific
VSPackage called a Language Service.
A language service defines various interfaces which the VSPackage
•implementation
can implement to add support for various
functionality. Functionality that can be added this way includes syntax
coloring, statement completion, brace matching, parameter
information tooltips, member lists and error markers for background
compilation.
13A-7
Visual Studio 2005
• Visual Studio does not support any programming language, solution
or tool.
it allows various functionality to be plugged in.
•Instead,
functionality is coded as a VSPackage.
•Specific
installed, the functionality is available as a Service.
•When
provides three services:
•The IDE
– SVsSolution,
– SVsUIShell,
– and SVsShell
13A-8
Visual Studio 2005
• Visual Studio does not include any source control support built in
but it defines the MSSCCI (Microsoft Source Code Control Interface) by
implementing which source control systems can integrate with the
IDE.
MSSCCI defines a set of functions that are used to implement various
•source
control functionality.
MSSCCI was first used to integrate Visual SourceSafe with Visual
•Studio
6.0 but was later opened up via the Visual Studio SDK.
13A-9
Visual Studio 2005
• Visual Studio supports running multiple instances of the
environment (each with its own set of VSPackages).
The instances use different registry hives to store their configuration
•state
and are differentiated by their AppId (Application ID). The
instances are launched by an AppId-specific .exe that selects the
AppId, sets the root hive and launches the IDE. VSPackages registered
for one AppId are integrated with other VSPackages for that AppId. The
various product editions of Visual Studio are created using the
different AppIds.
13A-10
Visual Studio 2005
The Visual Studio Express edition products are installed with their
own AppIDs, but the Standard, Professional and Team Suite products
share the same AppId. Consequently, the Express editions can be
installed side-by-side with other editions, unlike the other editions
which update the same installation.
The professional edition includes a superset of the VSPackages in the
standard edition and the team suite includes a superset of the
VSPackages in both other editions.
13A-11
Visual Studio 2005 - Features
CODE EDITOR
•The
• Visual Studio code editor showing IntelliSense suggestions.
13A-12
Visual Studio 2005 - Features
Visual Studio, like any other IDE, includes a code editor that supports
syntax highlighting and code completion using IntelliSense for not
only variables, functions and methods but also language constructs
like loops and queries.
IntelliSense is supported for the included languages, as well as for
XML and for Cascading Style Sheets and JavaScript when developing
web sites and web applications.
13A-13
Visual Studio 2005 - Features
Autocomplete suggestions are popped up in a modeless list box,
overlaid on top of the code editor. In Visual Studio 2008 onwards, it
can be made temporarily semi-transparent to see the code obstructed
by it.
The code editor is used for all supported languages.
13A-14
Visual Studio 2005 - Features
CODE EDITOR
The Visual Studio code editor also supports setting bookmarks in
code for quick navigation.
Other navigational aids include collapsing code blocks and
incremental search, in addition to normal text search and regex
search. The code editor also includes a multi-item clipboard and a task
list.
•
13A-15
Visual Studio 2005 - Features
The code editor supports code snippets, which are saved templates
for repetitive code and can be inserted into code and customized for
the project being worked on. A management tool for code snippets is
built in as well.
These tools are surfaced as floating windows which can be set to
automatically hide when unused or docked to the side of the screen.
The Visual Studio code editor also supports code refactoring including
parameter reordering, variable and method renaming, interface
extraction and encapsulation of class members inside properties,
among others.
13A-16
Visual Studio 2005 - Features
CODE EDITOR
Visual Studio features background compilation (also called
incremental compilation). As code is being written, Visual Studio
compiles it in the background with in order to provide feedback about
syntax and compilation errors, which are flagged with a red wavy
underline.
Warnings are marked with a green underline.
Background compilation does not generate executable code, since it
requires a different compiler than the one used to generate executable
code.
•
13A-17
Visual Studio 2005 - Features
DEBUGGER
Visual Studio includes a debugger that works both as a source-level
debugger as well as machine-level debugger.
It works with both managed code as well as native code and can be
used for debugging applications written in any language supported by
Visual Studio.
In addition, it can also attach to running processes and monitor and
debug those processes.
•
13A-18
Visual Studio 2005 - Features
If source code for the running process is available, it displays the
code as it is being run.
source code is not available, it can show the disassembly.
•IfThe
Visual Studio debugger can also create memory dumps as well
•as load
them later for debugging.
programs are also supported.
•Multi-threaded
The debugger can be configured to be launched when an application
•running
outside the Visual Studio environment crashes.
•
13A-19
Visual Studio 2005 - Features
DEBUGGER
•The
debugger allows setting breakpoints (which allow execution to be
stopped temporarily at a certain position) and watches (which monitor
the values of variables as the execution progresses).
Breakpoints can be conditional, that is they get triggered when the
condition is met. Code can be stepped over, i.e., run one line (of
source code) at a time.
It can either step into functions to debug inside it, or step over it, i.e.,
the execution of the function body isn't available for manual
inspection.
13A-20
Visual Studio 2005 - Features
The debugger supports Edit and Continue, i.e., it allows code to be
•edited
as it is being debugged.
When debugging, if any variable is hovered over by the mouse
•pointer,
its current value is displayed in a tooltip ("data tooltips"),
where it can also be modified if desired. During coding, the Visual
Studio debugger lets certain functions be invoked manually from the
Immediate tool window.
•The parameters to the method are supplied at the Immediate window.
13A-21
Visual Studio 2005 - Features
DESIGNER
Visual Studio includes a host of visual designers to aid in the
development of applications. These tools include:
WinForms Designer
•
13A-22
Visual Studio 2005 - Features
The WinForms designer is used to build GUI applications using
WinForms.
It includes a palette of UI widgets and controls (including buttons,
progress bars, labels, layout containers and other controls) that can
be dragged and dropped on a form surface.
Layout can be controlled by housing the controls inside other
containers or locking them to the side of the form. Controls that
display data (like textbox, list box, grid view, etc.) can be data bound
to data sources like databases or queries. The UI is linked with code
using an event-driven programming model.
13A-23
Visual Studio 2005
• Accompanying the forthcoming release of .NET Framework 2.0 is a
new set of development tools in the form of Visual Studio 2005. This is
available in a number of permutations, ranging from the cut-down
Express versions up to the new Visual Studio 2005 Team System.
13A-24
Visual Studio 2005
• There are five Express versions of Visual Studio 2005. These are
low-cost language or technology-specific tools and include
Basic 2005 Express,
– Visual
C# 2005 Express,
– Visual
C++ 2005 Express,
– Visual
J# 2005 Express
– Visual
– and Visual Web Developer 2005 Express.
13A-25
Visual Studio 2005
• The latter supports all three languages, but does not support
Windows Forms development. There is also SQL Server 2005 Express,
a cut-down version of SQL Server 2005 that effectively replaces MSDE,
and is available as a free download. You can see the Express range of
tools and download the beta versions at
http://lab.msdn.microsoft.com/express/.
13A-26
Visual Studio 2005
•
Then there are the Visual Studio 2005 Standard and Professional
Editions. These include all the Microsoft .NET languages, namely
Visual Basic, C# and J#. They also add more features, such as mobile
device development, the database design tools, the Class Designer.
13A-27
Visual Studio 2005
•
The Professional Edition comes with Crystal Reports as well as the
SQL Server Reporting Services, and adds support for high-end
features such as remote debugging, SQL Server 2005 integration and
64-bit compilation.
It also includes SQL Server 2005 Developer Edition.
•
13A-28
Visual Studio 2005
•
Finally there is the Visual Studio Team System (VSTS) suite, which
is aimed at supporting the whole of the development life-cycle.
We now look at the new features in Visual Studio 2005 Professional.
•The
Edition and the Express versions implement many of
•theseStandard
features within the standard IDE, but do not provide all the
associated tools and resources.
13A-29
Visual Studio 2005
•
There are too many new features in Visual Studio 2005 to cover
them all in detail, and some are not of importance to developers as
they just make features of Visual Studio work more smoothly or
improve the general interface and performance of the tool.
However, the more important changes in Visual Studio 2005 are
•described
in the following slides.
13A-30
Visual Studio 2005
Studio 2005 for ASP.NET developers
•··Visual
Studio 2005 for Windows Forms developers
•··Visual
relational and XML data in Visual Studio 2005
•··Handling
•··Debugging in Visual Studio 2005
13A-31
Visual Studio 2005 – for Web dev
•
Web developers will find that Visual Studio 2005 really does provide a great
working environment for ASP.NET and Web Service applications. There are
many improvements over earlier versions of Visual Studio, some of which come
about through the new features of ASP.NET itself (such as the new controls for
accessing and displaying data). Other improvements are the result of changes
to the way that the development environment works. Amongst the new features
and improvements are:
13A-32
Visual Studio 2005 – for Web dev
• An improved code-behind model and inline code page support
support for deployment and site maintenance
• Improved
Improved editing features
• An
• integrated Web administration tool
13A-33
Visual Studio 2005 – for WinForm dev
•
Windows Forms developers get some useful new features and enhancements
in Visual Studio 2005.
Improved editing features include a new technique for aligning controls called
•Snap
Lines, and new Smart Tags for controls on a Form.
There are also built-in features to support ClickOnce deployment, a new
•object
to make asynchronous application execution easier, and support for a
range of mobile and Smart Device applications.
13A-34
Visual Studio 2005 – for WinForm dev
•
Improved editing features
Generally, when you build an application, you spend time trying to get the
interface to look as attractive as possible. One area where Visual Studio 2005
makes this easier is through a new feature for control alignment in the Form
Designer window.
Called Snap Lines, this feature displays lines between the control you are
•dragging
and dropping onto the Form and any existing controls, so that you
can easily align them:
13A-35
Visual Studio 2005 – for WinForm dev
Using Snap Lines to make control alignment on a Form much easier
13A-36
Visual Studio 2005 – for WinForm dev
•
A second new feature that makes it easier to work with Windows Forms
controls is the provision of new Smart Tags for controls.
These are similar to those seen in our article discussing Visual Studio 2005 for
•ASP.NET
developers, allowing you to set common properties, configure the
control for common tasks, and change the appearance and behavior of the
control right there within the editor.
13A-37
Visual Studio 2005 – for WinForm dev
Using the new Smart Tags for a control in a Windows Forms application
13A-38
Visual Studio 2005 – for WinForm dev
•
Mobile and Smart Device Applications
Visual Studio 2005 provides full integrated support for building applications
that target Windows Mobile devices such as the Pocket PC and SmartPhone.
You can create these types of applications directly from the New Project
•dialog:
13A-39
Visual Studio 2005 – for WinForm dev
13A-40
Creating a new Smart Device project
Visual Studio 2005 – for WinForm dev
When a Smart Device project is chosen, the editor opens with the
appropriate emulator as the editing surface. You add controls to the Form and
write code just as you do for a standard Windows Forms application.
The editor provides a view that helps you tailor your design to the capabilities

and size of the device, while the Toolbox lists only the controls supported on
that device.
When you run your application, it is displayed inside the emulator so that you

get a real feel for how it will behave in the actual device.

13A-41
Visual Studio 2005 – for WinForm dev
13A-42
Visual Studio 2005 – for WinForm dev
Asynchronous Background Execution
Visual Studio allows you to insert instances of the new BackgroundWorker
control into your application so that you can implement processing that is
initiated on a separate thread from that which is used to execute the UI and the
remainder of the application.
You specify the tasks for asynchronous execution in the DoWork method and

then handle the ProgressChanged event if you want to monitor the code, and
the RunWorkerCompleted event which is raised when execution is complete.

13A-43
Visual Studio 2005
• For a general introduction to Visual Studio 2005,
with links to the various product enhancements and
more detail of each of the new features, go to
http://msdn2.microsoft.com/library/fx6bk1f4.aspx.
To learn more about the features for Web developers
and ASP.NET, try
http://msdn2.microsoft.com/library/s57a598e.aspx.
For more details of the way that the new IDE
supports new and existing features of the most
popular programming language, try the following
links. For VB.NET developers, go to
http://msdn2.microsoft.com/library/y17w47af.aspx.
13A-44
The End
Questions?
McGraw-Hill Technology Education
Copyright © 2006 by The McGraw-Hill Companies, Inc. All rights reserved.