ConTenTs
chaPter 44: uPGradinG with Visual studio 2010 905
Upgrading from Visual studio 2008 905
Upgrading to .neT framework 4.0 909
summary 910
chaPter 45: build custoMization 911
General Build options 911
Manual Dependencies 914
The Visual Basic Compile Page 915
Advanced Compiler Settings 916
Build Events 917
C# Build Pages 919
MsBuild 920
How Visual Studio Uses MSBuild 921
The MSBuild Schema 923
Assembly Versioning via MSBuild Tasks 925
summary 927
chaPter 46: asseMbly VersioninG and siGninG 929
assembly naming 929
Version Consistency 932
strongly named assemblies 933
The Global assembly Cache 933
signing an assembly 934
summary 936
chaPter 47: obfuscation, aPPlication MonitorinG,
and ManaGeMent 937
The Msil Disassembler 938
Decompilers 939
obfuscating Your Code 941
Dotfuscator Software Services 941
Obfuscation Attributes 945
Words of Caution 948
application Monitoring and Management 949
Tamper Defense 950
contents
Runtime Intelligence Instrumentation and Analytics 952
Application Expiry 956
Application Usage Tracking 957
summary 959
chaPter 48: PackaGinG and dePloyMent 961
Windows installers 961
Building an Installer 962
Customizing the Installer 966
Adding Custom Actions 970
The Service Installer 973
Clickonce 976
One Click to Deploy 976
One Click to Update 980
summary 982
chaPter 49: web aPPlication dePloyMent 983
Web site Deployment 984
Publish Web Site 984
Copy Web Site 985
Web application Deployment 986
Publishing a Web Application 986
Packaging a Web Application 987
web config Transformations 989
Web Project installers 991
The Web Platform installer 992
Extending the Web Platform Installer 993
summary 997
Part xi: custoMizinG and extendinG Visual studio
chaPter 50: the autoMation Model 1001
Visual studio extensibility options 1001
The Visual studio automation Model 1002
An Overview of the Automation Model 1002
Solutions and Projects 1004
Windows and Documents 1005
Commands 1006
ConTenTs
Debugger
Events
summary
chaPter 51: add-ins
1007
1007
1008
1009
Developing an add-in 1009
The Add-in Wizard
1010
Project Structure 1012
Testing Your Add-in 1013
The AddIn File 1014
The Connect Class 1015
Creating a Tool Window 1015
Accessing the Visual Studio Automation Model 1018
Handling Visual Studio Events 1020
Deploying add-ins 1022
summary 1023
chaPter 52: Macros 1025
Understanding Macros 1025
The Macro explorer Tool Window 1026
The Macros iDe 1026
Creating a Macro 1027
How to Record a Macro 1028
How to Develop a Macro 1028
running a Macro 1030
Deploying Macros 1030
summary 1031
chaPter 53: ManaGed extensibility fraMework (Mef) 1033
Getting started with Mef 1034
Imports and Exports 1036
Contracts 1037
Catalogs 1040
Advanced MEF 1041
The Visual studio 2010 editor 1041
The Text Model Subsystem
1042
The Text View Subsystem
1042
The Classification Subsystem
1043
The Operations Subsystem
1043
contents
extending the editor 1044
Editor Extension Points 1045
Editor Services 1050
The Check Comment Highlighter Extension 1050
summary 1057
Part xii: Visual studio ultiMate (aVailable online)
chaPter 54: Visual studio ultiMate for architects 1061
Modeling Projects 1061
UML Diagrams 1062
UML Model Explorer 1066
Using Layer Diagrams to Verify Application Architecture 1066
Linking to Team Foundation Server 1068
exploring Code 1068
The Architecture Explorer 1068
Dependency Graphs 1070
Generate Sequence Diagram 1072
summary 1073
chaPter 55: Visual studio ultiMate for deVeloPers 1075
Code Metrics 1075
Lines of Code 1076
Depth of Inheritance 1077
Class Coupling 1077
Cyclomatic Complexity 1078
Maintainability Index 1078
Excluded Code 1078
Managed Code analysis Tool 1078
C/C++ Code analysis Tool 1079
Profiling Tools 1080
Configuring Profiler Sessions 1080
Reports 1082
stand-alone Profiler 1083
intelliTrace 1084
Database Tools 1086
SQL-CLR Database Project 1086
Offline Database Schema 1086
Data Generation 1089
Database Refactoring 1090
ConTenTs
Schema Compare
1091
Data Compare 1092
Static Analysis 1093
Transact-SQL Editor
1093
Best Practices 1093
summary 1094
chaPter 56: Visual studio ultiMate for testers
1095
automated Tests 1095
Web Performance Tests 1096
Load Tests 1099
Database Unit Test 1100
Coded UI Test 1101
Generic Tests 1102
Ordered Test 1102
relating Code and Tests 1103
Code Coverage 1103
Test Impact Analysis 1105
Visual studio Test Management 1105
Test and lab Manager 1106
Testing Center 1106
Lab Center 1108
summary 1110
chaPter 57: teaM foundation serVer 1111
Team Project 1112
Process Templates 1112
Work item Tracking 1113
Work Item Queries 1114
Work Item Types 1115
Adding Work Items 1116
Work Item State 1116
excel and Project integration 1117
Excel 1117
Project 1118
Version Control 1119
Working from Solution Explorer
1120
Check Out 1121
Check In 1121
Resolve Conflicts
1122
contents
Working Offline 1124
Label 1124
History 1125
Annotate 1125
Shelve 1125
Branch 1126
Merge 1128
Team foundation Build 1128
reporting and Business intelligence 1130
Team Portal 1132
Documents 1132
Process Guidance 1132
SharePoint Lists 1132
Dashboards 1132
Team system Web access 1133
administering Tfs 1134
Tfs automation and Process Customization 1135
Work Item Types 1135
Customizing the Process Template 1136
summary 1137
Index 1139
introduction
Visual Studio 2010 is an enormous product no matter which way you look at it. Incorporating the
latest advances in Microsoft’s premiere programming languages, Visual Basic and C#, along with a
host of improvements and new features in the user interface, can be intimidating to both newcomers
and experienced .NET developers.
Professional Visual Studio 2010 looks at every major aspect of this developer tool, showing you
how to harness each feature and offering advice about how best to utilize the various components
effectively. It shows you the building blocks that make up Visual Studio 2010, breaking the user
interface down into manageable chunks for you to understand.
It then expands on each of these components with additional details about exactly how it works
both in isolation and in conjunction with other parts of Visual Studio 2010 to make your
development efforts even more efficient.
who this book is for
Professional Visual Studio 2010 is for all developers new to Visual Studio as well as those programmers
who have some experience but want to learn about features they may have previously overlooked.
If you are familiar with the way previous versions of Visual Studio worked, you may want to skim
over Part I, which deals with the basic constructs that make up the user interface, and move on to
the remainder of the book where the new features found in Visual Studio 2010 are discussed in
detail. While you may be familiar with most of Part I, it is worth reading this section in case there
are features of Visual Studio 2010 that you haven’t seen or used before.
If you’re just starting out, you’ll greatly benefit from the first part, where basic concepts are
explained and you’re introduced to the user interface and how to customize it to suit your own style.
what this book coVers
Microsoft Visual Studio 2010 is arguably the most advanced integrated development environment
(IDE) available for programmers today. It is based on a long history of programming languages
and interfaces and has been influenced by many different iterations of the theme of development
environments.
The next few pages introduce you to Microsoft Visual Studio 2010, how it came about, and what
it can do for you as a developer. If you’re already familiar with what Visual Studio is and how it
came to be, you may want to skip ahead to the next chapter and dive into the various aspects of the
integrated development environment itself.
introduction
a brief history of Visual studio
Microsoft has worked long and hard on its development tools. Actually, its first software product
was a version of BASIC in 1975. Back then, programming languages were mainly interpretive
languages in which the computer would process the code to be performed line by line. In the past
three decades, programming has seen many advances, one of the biggest by far being development
environments aimed at helping developers be efficient at producing applications in their chosen
language and platform.
In the 32-bit computing era, Microsoft started releasing comprehensive development tools, commonly
called IDEs (integrated development environments), which contained not just a compiler but also
a host of other features to supplement it, including a context-sensitive editor and rudimentary
IntelliSense features that helped programmers determine what they could and couldn’t do in a given
situation. Along with these features came intuitive visual user interface designers with drag-and-drop
functionality and associated tool windows that gave developers access to a variety of properties for
the various components on a given window or user control.
Initially, these IDEs were different for each language, with Visual Basic being the most advanced in
terms of the graphical designer and ease of use, and Visual C++ having the most power and flexibility.
Under the banner of Visual Studio 6, the latest versions of these languages were released in one large
development suite along with other “Visual” tools such as FoxPro and InterDev. However, it was obvious
that each language still had a distinct environment in which to work, and as a result, development
solutions had to be in a specific language.
one comprehensive environment
When Microsoft first released Visual Studio .NET in 2002, it inherited many features and attributes
of the various, disparate development tools the company had previously offered. Visual Basic 6,
Visual InterDev, Visual C++, and other tools such as FoxPro all contributed to a development effort
that the Microsoft development team mostly created on its own. The team had some input from
external groups, but Visual Studio .NET 2002 and .NET 1.0 were primarily founded on Microsoft’s
own principles and goals.
Visual Studio .NET 2003 was the next version released, and it provided mostly small enhancements
and big fixes. Two years later, Visual Studio 2005 and the .NET Framework 2.0 were released.
Subsequently Visual Studio 2008, coupled with the .NET Frameworks 3.0 and 3.5, was then
released. These were both major releases with new foundation framework classes that went far
beyond anything Microsoft had released previously. However, the most significant part of these
releases was realized in the IDE where the various components continued to evolve in a cohesive way
to provide you with an efficient tool set where everything was easily accessible.
The latest release, Visual Studio 2010 and .NET Framework 4.0, builds on this strong foundation.
With the code shell being re-written to use Windows Presentation Foundation, many of the now
out-dated designers have been given a new lease of life. In addition there are new designers to assist
with building Silverlight applications and built-in support for building Office applications.
introduction
Visual Studio 2010 comes in several versions: Express, Professional, Premium and Ultimate. The
majority of this book deals with the Professional Edition of Visual Studio 2010, but some parts utilize
features found only in the Premium and Ultimate editions. If you haven’t used these editions before, read
through Chapters 54 to 57 (available online) for an overview of the features they offer over and above the
Professional Edition.
how this book is structured
This book’s first section is dedicated to familiarizing you with the core aspects of Visual Studio
2010. Everything you need is contained in the first five chapters, from the IDE structure and layout
to the various options and settings you can change to make the user interface synchronize with your
own way of doing things.
From there, the remainder of the book is broken into 11 parts:
.
Getting Started: In this part, you learn how to take control of your projects and organize
them in ways that work with your own style.
.
Digging Deeper: Though the many graphical components of Visual Studio that make a
programmer’s job easier are discussed in many places throughout this book, you often need
help when you’re in the process of actually writing code. This part deals with features that
support the coding of applications such as IntelliSense, code refactoring, and creating and
running unit tests In the latest version of the .NET Framework, enhancements were added
to support dynamic languages and move towards feature parity between the two primary
.NET languages, C# and VB. This part covers changes to these languages, as well as
looking at a range of features that will help you write better and more consistent code.
.
Rich Client and Web Applications: For support building everything from Office add-ins to
cloud applications, Visual Studio enables you to develop applications for a wide range of
platforms. These two parts cover the application platforms that are supported within Visual
Studio 2010, including ASP.NET and Office, WPF, Silverlight 2 and ASP.NET MVC.
.
Data: A large proportion of applications use some form of data storage. Visual Studio 2010