Microsoft Visual Studio: An Integrated Windows Program Development Environment
Microsoft Visual Studio: An Integrated Windows Program Development Environment
An Integrated Windows
Program Development
Environment
1
Visual Studio Capabilities
• Generate starter applications without
writing code
• View a programming project in many
different ways
• Edit source and include files
• Build the application’s user interface
visually
• Build (compile and link) an application
• Debug an application while it runs
• Obtain online help
• Lots of others
2
.NET Language Compilers
• Unmanaged Code C/C++ Compiler
– translates source programs to machine language
– detects and reports errors
– generates object (.obj) files for linker
• Managed Code .NET Language Compilers
– Many of them ? multi-language interoperability
– Translate source programs to MSIL
– Generate a “Portable Executable” that must be
translated by the CLR
• Resource Compiler
– Reads .rc file
– Generates binary resource (.res) file for linker
The Linker
• Reads compiler .obj and .res files
• Accesses C/C++/Windows libraries
• Generates executable (.exe or .dll)
3
Program Build and Run in the
.NET Framework
Common
Language
Runtime
4
The Debugger
• Powerful source code debugger
• Integrated with all parts of Visual Studio
• Features
– breakpoints
– tracing through/over functions
– variable watch windows
– much more
• See Appendix C of Deitel text book
The Wizards
• AppWizard
– Windows code generator for MFC apps
– automatically creates working program
templates & skeleton code
• ClassWizard
– facilitates easy extension of AppWizard-
generated classes
– creation of new classes
– used to tailor AppWizard-generated MFC &
.NET skeletons
– Accessible in the Properties Window in .NET
5
Help
• Hover over key words in edit window and a
one-line help message appears
• More detailed help can be obtained by:
– ‘Start Page’ – ‘Developer Center’
• To access the MSDN Online Library
• Easier to use the ‘Help’ Menu Item
– ‘Dynamic Help’ – context sensitive
• Click on text in edit window and corresponding
topic appears in help window
• Click on topic in help window to get help
– ‘Contents’: Select a topic
– ‘Search’: Enter a topic
– ‘Index’: Enter/choose a topic
• Go to: http://msdn.microsoft.com
– Search MSDN for desired topic
– Some examples:
• Windows API reference
• MFC reference
• Windows forms class library
6
Using Visual Studio
• To prepare many kinds of applications
– Win32 Console Applications (DOS programs)
– Win32 API Apps in C or VC++
– MFC Apps in VC++
– DLLs
– .NET Windows Forms Apps in Managed C#, VB,
VC++, and other languages
– ASP.NET Web Apps and Services
– ADO.NET Data Base Apps
– Others
7
Toolbars
• Contain Icons--instant routes to main menu
functions
• Many of them
• May not be visible
• If not, right click on any visible toolbar
• Brings up following popup window
• Can activate a toolbar by clicking on its
check box
8
Keyboard Shortcuts
• All Menu/Toolbar selections are available
from the keyboard using key combinations
• Can be faster
• More information in Online Help
– ‘Index’ | ‘Keyboard Shortcuts’ | ‘Predefined’
9
Solutions and Projects
• Solution
– A single application
– Can contain one or more projects
• In Managed applications, projects can be in different
languages
– Overall solution information stored in a .SLN file
– Open this when you want to work on a solution
• Project
– Basic component of an application
– Collection of files:
• Source, headers, resources, settings, configuration
information, many more
10
Temporary Visual Studio Generated
Files
• Many are very big and can (should) be removed!
• .obj Compiler machine code translation
• .ilk Incremental link file
• .pch Precompiled header (huge!!!)
• .pdb Precompiled debugging info
• .idb Incremental debug info
• .ncb intellisense database
• .aps Supports viewing resources
• Others
• Can be deleted
Program Configurations
• Debug
– appends debugging information
– produces more and larger files
• Release
– no debugging information
– optimized for size, performance, & efficiency
11
Setting the Configuration
• Click ‘Build’ on Main Menu
• Choose ‘Configuration Manager’
• Choose desired configuration (‘Debug’ or
‘Release’) in Configuration Manager’s
‘Active Solution Configuration Box’
• Default is ‘Debug’
12
• Click ‘Application Settings’ in resulting
‘Win32 Application Wizard’ Box
– Select ‘Windows Application’ from
‘Application Type’ radio buttons
– Select ‘Empty Project’ from ‘Additional
Options’ check boxes
– Click ‘Finish’
13
• Alternative Way of Adding a Source File
to a Project:
– You can also copy an existing source code file
into the project’s subdirectory
– Then as before:
• Choose ‘Project’ | ‘Add Existing Item’ from the
menu
• Select the .cpp file & click ‘Open’
– Should appear in Solution Explorer window
– Open it by double clicking on it
14
Compiling from Command Line
• Command Line Compilers:
– C++: CL.EXE
– C# : CSC.EXE
– Visual Basic: VBC.EXE
• All are run from a DOS session, but
directory paths must be set correctly
• Easiest to start a Visual Studio 2005
Command Prompt (paths already set)
– From Task Bar:
• Start | All Programs | Microsoft Visual Studio 2005 |
Visual Studio Tools | Visual Studio 2005 Command
Prompt
15
• Cleanup:
– Copy solution, project, source, header, resource
files to disk
– Copy .exe file from project's Debug directory
– Best: Delete all temporary files & copy entire
solution (project directory) to floppy or CD
– Delete project directory from hard drive
• Exiting Developer Studio:
– ‘File’ | ‘Exit’ from menu
16