Professional Visual Studio 2012 9781118337707, 9781118416488, 9781118434079, 9781118463901, 1118337700

The ultimate developers' guide to Visual Studio 2012 This expert Wrox guide is what you need to get up and running

338 14 27MB

English Pages 1104 [1103] Year 2012

Report DMCA / Copyright

DOWNLOAD FILE

Professional Visual Studio 2012
 9781118337707, 9781118416488, 9781118434079, 9781118463901, 1118337700

Table of contents :
Professional Visual Studio® 2012......Page 7
Copyright......Page 8
Credits......Page 10
About the Author......Page 11
Acknowledgments......Page 13
Contents......Page 15
What this Book Covers......Page 41
How this Book is Structured......Page 42
What You Need to Use this Book......Page 43
Errata......Page 44
P2P.wrox.Com......Page 45
Part I: Integrated Development Environment......Page 47
Installing Visual Studio 2012......Page 49
Running Visual Studio 2012......Page 50
The Visual Studio IDE......Page 51
Developing, Building, Debugging, and Deploying Your First Application......Page 53
Summary......Page 58
The Solution Explorer......Page 59
Previewing Files......Page 61
Common Tasks......Page 62
The Toolbox......Page 67
Arranging Components......Page 69
Adding Components......Page 70
Properties......Page 71
Extending the Properties Window......Page 73
Summary......Page 76
The Start Page......Page 77
Window Layout......Page 78
Navigating Open Items......Page 79
Docking......Page 80
The Editor Space......Page 83
Visual Guides......Page 84
Tracking Changes......Page 86
Keyboard Shortcuts......Page 87
Quick Launch......Page 88
Projects and Solutions......Page 89
Build and Run......Page 90
Importing and Exporting Settings......Page 91
Summary......Page 93
The Code Editor Window Layout......Page 95
Regions......Page 96
Code Formatting......Page 97
Split View......Page 99
Tear Away (Floating) Code Windows......Page 100
Duplicating Solution Explorer......Page 101
Advanced Functionality......Page 102
The Command Window......Page 104
The Class View......Page 105
The Error List......Page 106
The Code Definition Window......Page 107
The Call Hierarchy Window......Page 108
HTML Outlining......Page 109
Control Outlining......Page 110
Summary......Page 112
Quick Find/Replace......Page 113
Quick Find......Page 114
Find Options......Page 115
Find in Files......Page 116
Find Dialog Options......Page 117
Regular Expressions......Page 118
Results Window......Page 119
Navigate To......Page 120
Accessing Help......Page 121
Navigating and Searching the Help System......Page 122
Summary......Page 123
Part II: Getting Started......Page 125
Solution Structure......Page 127
Solution Properties......Page 129
Common Properties......Page 130
Configuration Properties......Page 131
Project Types......Page 132
Project Properties......Page 134
Application......Page 135
Compile (Visual Basic Only)......Page 138
Build (C# and F# Only)......Page 139
Debug......Page 140
References (Visual Basic Only)......Page 142
Services......Page 143
Settings......Page 144
Reference Paths (C# and F# Only)......Page 145
My Extensions (Visual Basic Only)......Page 146
Security......Page 147
Code Analysis......Page 148
Web......Page 149
Silverlight Applications......Page 150
Package/Publish Web......Page 151
Package/Publish SQL......Page 152
Summary......Page 153
IntelliSense Explained......Page 155
General IntelliSense......Page 156
Completing Words and Phrases......Page 157
Parameter Information......Page 162
JavaScript IntelliSense......Page 163
Referencing Another JavaScript File......Page 164
General Options......Page 165
C#-Specific Options......Page 167
Code Snippets......Page 168
Bookmarks and the Bookmark Window......Page 169
Summary......Page 171
Chapter 8: Code Snippets and Refactoring......Page 173
Storing Code Blocks in the Toolbox......Page 174
Using Snippets in C#......Page 175
Using Snippets in VB......Page 176
Surround With Snippet......Page 177
Code Snippets Manager......Page 178
Reviewing Existing Snippets......Page 179
Accessing Refactoring Support......Page 182
Extract Method......Page 183
Extract Interface......Page 186
Remove Parameters......Page 189
Rename......Page 190
Organize Usings......Page 191
Summary......Page 192
Server Connections......Page 193
Event Logs......Page 194
Management Classes......Page 196
Management Events......Page 198
Message Queues......Page 200
Performance Counters......Page 202
Services......Page 205
SharePoint Connections......Page 206
Summary......Page 207
Creating a Class Diagram......Page 209
The Design Surface......Page 210
Entities......Page 211
The Class Details......Page 212
The Properties Window......Page 213
Exporting Diagrams......Page 214
Drag-and-Drop Code Generation......Page 215
Refactoring with the Class Designer......Page 217
Visualization Enhancements......Page 218
Functionality Enhancements......Page 219
Summary......Page 220
Part III: Digging Deeper......Page 221
Your First Test Case......Page 223
Additional Test Attributes......Page 229
The Assert Class......Page 231
The ExpectedException Attribute......Page 232
AssemblyInitialize and AssemblyCleanup......Page 234
Data......Page 235
Writing Test Output......Page 237
Custom Properties......Page 238
Testing Private Members......Page 239
Testing Code Contracts......Page 240
Summary......Page 242
Inline Commenting......Page 243
Adding XML Comments......Page 244
XML Comment Tags......Page 245
Using XML Comments......Page 257
Generating Documentation with GhostDoc......Page 258
Compiling Documentation with Sandcastle......Page 260
Task List Comments......Page 262
Summary......Page 264
Source Control......Page 265
Selecting a Source Control Repository......Page 266
Accessing Source Control......Page 268
Code Analysis with FxCop......Page 272
Style Using StyleCop......Page 275
Code Contracts......Page 276
Summary......Page 278
Creating a T4 Template......Page 279
T4 Building Blocks......Page 282
Statement Blocks......Page 283
Class Feature Blocks......Page 285
How T4 Works......Page 286
Template Directive......Page 288
Import Directive......Page 289
Include Directive......Page 290
Compiling Transformation Errors......Page 291
Generating Code Assets......Page 292
Runtime Text Templates......Page 296
Using Runtime Text Templates......Page 297
Differences Between Runtime Text Templates and Standard T4 Templates......Page 299
Tips and Tricks......Page 300
Summary......Page 301
Item Template......Page 303
Project Template......Page 307
Template Structure......Page 308
Template Parameters......Page 309
Template Project Setup......Page 311
IWizard......Page 312
Generating the Extended Project Template......Page 317
Starter Kits......Page 318
Summary......Page 319
Hitting a Nail with the Right Hammer......Page 321
Dynamic......Page 322
What's It All Mean?......Page 323
The Async Keyword......Page 324
Caller Information......Page 326
The Global Keyword......Page 327
Visual Basic PowerPacks......Page 328
Your First F# Program......Page 329
Exploring F# Language Features......Page 331
Query Expressions......Page 333
Summary......Page 334
Part IV: Rich Client Applications......Page 335
Getting Started......Page 337
The Windows Form......Page 338
Window Style Properties......Page 339
Form Design Preferences......Page 340
Adding and Positioning Controls......Page 342
Automatic Positioning of Multiple Controls......Page 343
Tab Order and Layering Controls......Page 344
Setting Control Properties......Page 345
Service-Based Components......Page 346
Panel and SplitContainer......Page 347
FlowLayoutPanel......Page 348
Docking and Anchoring Controls......Page 349
Summary......Page 350
What Is WPF?......Page 351
Getting Started with WPF......Page 353
XAML Fundamentals......Page 355
The WPF Controls......Page 356
The WPF Layout Controls......Page 357
The WPF Designer and XAML Editor......Page 359
Working with the XAML Editor......Page 360
Working with the WPF Designer......Page 361
The Properties Tool Window......Page 363
Data Binding Features......Page 367
Styling Your Application......Page 370
Windows Forms Interoperability......Page 371
Hosting a WPF Control in Windows Forms......Page 372
Hosting a Windows Forms Control in WPF......Page 373
Debugging with the WPF Visualizer......Page 374
Summary......Page 376
Choosing an Office Project Type......Page 377
Document-Level Customizations......Page 378
Your First VSTO Project......Page 379
Protecting the Document Design......Page 382
Adding an Actions Pane......Page 383
Some Outlook Concepts......Page 384
Creating an Outlook Form Region......Page 385
Unregistering an Add-in......Page 389
Disabled Add-ins......Page 390
Deploying Office Applications......Page 391
Summary......Page 392
What Is a Windows Store Application?......Page 393
Content Before Chrome......Page 394
Contracts......Page 395
Creating a Windows Store Application......Page 396
The Windows 8 Simulator......Page 399
Your Windows Store Application......Page 401
Summary......Page 404
Part V: Web Applications Chapter......Page 405
Chapter 21: Asp.Net Web Forms......Page 407
Creating Web Projects......Page 408
Creating a Web Site Project......Page 409
Creating a Web Application Project......Page 412
Other Web Projects......Page 413
The HTML Designer......Page 414
Positioning Controls and HTML Elements......Page 416
CSS Tools......Page 418
Validation Tools......Page 422
Navigation Components......Page 423
User Authentication......Page 424
Data Components......Page 425
Web Parts......Page 428
Master Pages......Page 429
Developing with JavaScript......Page 431
Working with ASP.NET AJAX......Page 432
Using AJAX Control Extenders......Page 434
ASP.NET Web Site Administration......Page 436
Security......Page 437
ASP.NET Configuration in IIS......Page 439
Summary......Page 440
Chapter 22: ASP.NET MVC......Page 441
Getting Started with ASP.NET MVC......Page 442
Choosing a Model......Page 444
MVC Scaffolding......Page 445
Rendering a UI with Views......Page 448
Routing......Page 455
Action Method Parameters......Page 458
Areas......Page 461
Validation......Page 463
Dynamic Data Templates......Page 465
jQuery......Page 468
Summary......Page 470
What Is Silverlight?......Page 471
Getting Started with Silverlight......Page 472
Navigation Framework......Page 478
Theming......Page 479
Enabling Running Out of Browser......Page 481
Summary......Page 484
Chapter 24: Dynamic Data......Page 485
Creating a Dynamic Data Web Application......Page 486
Adding a Data Model......Page 487
Exploring a Dynamic Data Application......Page 489
Customizing the Data Model......Page 490
Customizing Individual Data Fields......Page 491
Adding Custom Validation Rules......Page 493
Customizing the Display Format......Page 494
Customizing the Presentation......Page 495
Page Templates......Page 496
Field Templates......Page 499
Entity Templates......Page 501
Filter Templates......Page 503
Summary......Page 506
Chapter 25: SharePoint......Page 507
Installing the Prerequisites......Page 508
Installing SharePoint 2010......Page 510
Exploring SharePoint 2010......Page 511
Creating a SharePoint Project......Page 513
Developing Web Parts......Page 517
Creating Content Types and Lists......Page 518
Adding Event Receivers......Page 521
Creating SharePoint Workflows......Page 522
Working with Features......Page 524
Packaging and Deployment......Page 526
Summary......Page 527
Chapter 26: Windows Azure......Page 529
The Windows Azure Platform......Page 530
The Compute Emulator......Page 532
Table, Blob, and Queue Storage......Page 533
Application Deployment......Page 536
SQL Azure......Page 540
Azure Websites......Page 542
Connectivity......Page 543
Summary......Page 544
Part VI: Data......Page 545
Database Windows in Visual Studio 2012......Page 547
Server Explorer......Page 548
SQL Server Object Explorer......Page 552
Editing Data......Page 553
Summary......Page 554
DataSets Overview......Page 555
Adding a Data Source......Page 556
The DataSet Designer......Page 557
Binding Data......Page 560
BindingSource......Page 562
BindingNavigator......Page 564
Data Source Selections......Page 565
Saving Changes......Page 567
Inserting New Items......Page 569
Validation......Page 570
Customized DataSets......Page 571
BindingSource Chains and the DataGridView......Page 573
Working with Data Sources......Page 575
The Web Service Data Source......Page 577
Browsing Data......Page 578
Summary......Page 580
LINQ Providers......Page 581
Old-School Queries......Page 582
From......Page 584
Where......Page 585
Group By......Page 586
Order By......Page 587
Debugging and Execution......Page 588
LINQ to XML......Page 589
Creating XML with LINQ......Page 590
Querying XML......Page 592
Schema Support......Page 593
Creating the Object Model......Page 595
Querying with LINQ to SQL......Page 597
Binding LINQ to SQL Objects......Page 602
LINQPad......Page 604
Summary......Page 605
Chapter 30: The ADO.Net Entity Framework......Page 607
Entity Framework Concepts......Page 608
Creating an Entity Model......Page 609
The Entity Data Model Wizard......Page 610
The Entity Framework Designer......Page 613
Creating/Modifying Entities......Page 617
Creating/Modifying Entity Associations......Page 619
Updating an Entity Model with Database Changes......Page 620
LINQ to Entities Overview......Page 621
CRUD Operations......Page 622
Navigating Entity Associations......Page 626
Updating a Database from an Entity Model......Page 627
Summary......Page 628
Getting Started with Reporting......Page 629
Designing Reports......Page 631
Defining Data Sources......Page 632
Reporting Controls......Page 634
Expressions, Placeholders, and Aggregates......Page 646
Custom Code......Page 650
Report Layout......Page 654
Subreports......Page 655
The Report Wizard......Page 657
The Report Viewer Controls......Page 658
Generating the Report......Page 659
Rendering Reports to Different Formats......Page 660
Deploying Reports......Page 661
Summary......Page 662
Part VII: Application Services......Page 663
What Is WCF?......Page 665
Getting Started......Page 666
Creating the Service Contract......Page 667
Creating the Data Contract......Page 669
Configuring WCF Service Endpoints......Page 671
Hosting WCF Services......Page 674
Consuming a WCF Service......Page 679
Summary......Page 683
What Is Windows Workflow Foundation?......Page 685
Activities......Page 686
Bookmarks......Page 688
Tracking......Page 689
Getting Started......Page 690
The Workflow Foundation Designer......Page 692
Designing a Workflow......Page 695
Writing Code Activities......Page 697
Executing a Workflow......Page 699
Testing Workflows......Page 701
Hosting the Workflow Designer......Page 702
Summary......Page 706
Client Services......Page 707
Role Authorization......Page 710
User Authentication......Page 712
Settings......Page 714
Login Form......Page 718
Offline Support......Page 720
Summary......Page 723
Occasionally Connected Applications......Page 725
Server Direct......Page 726
Getting Started with Synchronization Services......Page 729
Synchronization Services over N-Tiers......Page 733
Summary......Page 734
Getting Started......Page 735
Domain Services......Page 737
Domain Operations......Page 739
Other Operation Types......Page 740
Consuming a Domain Service in Silverlight......Page 741
Summary......Page 745
Part VIII: Configuration and Resources......Page 747
Web.Config......Page 749
ApplicationHost.Config......Page 750
Section: configurationSections......Page 751
Section: runtime......Page 752
Section: system.net......Page 753
Section: system.web......Page 754
Configuration Attributes......Page 755
Using appSettings......Page 756
Project Settings......Page 757
Dynamic Properties......Page 758
Custom Configuration Sections......Page 759
User Settings......Page 763
Referenced Projects with Settings......Page 764
Summary......Page 766
Connection String Wizard......Page 767
SQL Server Format......Page 771
In-Code Construction......Page 772
Encrypting Connection Strings......Page 774
LocalDB......Page 775
Summary......Page 776
What Are Resources?......Page 777
Text File Resources......Page 778
Resx Resource Files......Page 779
Adding Resources......Page 780
Accessing Resources......Page 781
Designer Files......Page 782
Resourcing Your Application......Page 783
Control Images......Page 784
Cultures......Page 785
Loading Culture Resource Files......Page 786
Bitmap and Icon Loading......Page 787
ComponentResourceManager......Page 788
ResourceReader and ResourceWriter......Page 789
Custom Resources......Page 790
Summary......Page 793
Part IX: Debugging......Page 795
The Code Window......Page 797
The Breakpoints Window......Page 798
The Output Window......Page 799
The Immediate Window......Page 800
The Watch Windows......Page 801
Watch Windows 1–4......Page 802
Call Stack......Page 803
Modules......Page 804
The Memory Windows......Page 805
Disassembly......Page 806
IntelliTrace (Ultimate Edition Only)......Page 807
Parallel Stacks......Page 808
Parallel Tasks......Page 810
Exceptions......Page 811
Customizing the Exception Assistant......Page 812
Unwinding an Exception......Page 813
Summary......Page 814
Breakpoints......Page 815
Setting a Breakpoint......Page 816
Adding Break Conditions......Page 818
Working with Breakpoints......Page 820
Tracepoints......Page 821
Execution Control......Page 822
Stepping Through Code......Page 823
Edit and Continue......Page 824
Summary......Page 825
DataTips......Page 827
DebuggerBrowsable......Page 829
DebuggerHidden......Page 830
DebuggerStepThrough......Page 831
Type Proxies......Page 832
Visualizers......Page 834
Saving Changes to Your Object......Page 836
Summary......Page 838
Chapter 43: Debugging Web Applications......Page 839
Debugging Server-Side ASP.NET Code......Page 840
Web Application Exceptions......Page 842
Error Handling......Page 844
Setting Breakpoints in JavaScript Code......Page 845
Debugging Dynamically Generated JavaScript......Page 846
The Page Inspector......Page 847
Debugging Silverlight......Page 848
Page-Level Tracing......Page 850
Application-Level Tracing......Page 851
The Trace Viewer......Page 852
Health Monitoring......Page 853
Summary......Page 855
Start Actions......Page 857
Debugging with Code......Page 859
The Debug and Trace Classes......Page 860
Attaching to a Windows Process......Page 861
Attaching to a Web Application......Page 862
Remote Debugging......Page 864
IntelliTrace......Page 865
.NET Framework Source......Page 866
Multithreaded and Parallelized Application Debugging......Page 869
Mixed-Mode Debugging......Page 871
Generating Dump Files......Page 872
Debugging Dump Files......Page 873
Summary......Page 874
Part X: Build and Deployment......Page 875
Upgrading from Visual Studio 2010......Page 877
Upgrading to .NET Framework 4.5......Page 879
Summary......Page 881
General Build Options......Page 883
The Visual Basic Compile Page......Page 886
Advanced Compiler Settings......Page 887
Build Events......Page 889
C# Build Pages......Page 891
How Visual Studio Uses MSBuild......Page 892
The MSBuild Schema......Page 895
Assembly Versioning via MSBuild Tasks......Page 896
Summary......Page 897
Assembly Naming......Page 899
Version Consistency......Page 902
Strongly Named Assemblies......Page 903
Signing an Assembly......Page 904
Summary......Page 906
The MSIL Disassembler......Page 907
Decompilers......Page 909
Dotfuscator and Analytics......Page 910
Obfuscation Attributes......Page 914
Words of Caution......Page 916
Application Monitoring and Management......Page 918
Tamper Defense......Page 919
Runtime Intelligence Instrumentation and Analytics......Page 921
Application Expiry......Page 924
Application Usage Tracking......Page 925
Summary......Page 926
Chapter 49: Packaging and Deployment......Page 927
Building an Installer......Page 928
Using Heat to Create Fragments......Page 931
ClickOnce......Page 934
One Click to Deploy......Page 935
One Click to Update......Page 939
Summary......Page 940
Publish Web Site......Page 941
Web Application Deployment......Page 943
Publishing a Web Application......Page 944
Web Project Installers......Page 946
The Web Platform Installer......Page 947
Extending the Web Platform Installer......Page 948
Summary......Page 951
Part XI: Customizing and Extending Visual Studio......Page 953
Visual Studio Extensibility Options......Page 955
An Overview of the Automation Model......Page 956
Windows and Documents......Page 958
Commands......Page 960
Debugger......Page 961
Summary......Page 962
The Add-in Wizard......Page 963
Testing Your Add-in......Page 966
The .AddIn File......Page 968
Creating a Tool Window......Page 969
Accessing the Visual Studio Automation Model......Page 972
Handling Visual Studio Events......Page 973
Summary......Page 976
Chapter 53: Managed Extensibility Framework (MEF)......Page 977
Getting Started with MEF......Page 978
Imports and Exports......Page 979
Contracts......Page 981
Catalogs......Page 982
Advanced MEF......Page 983
The Text View Subsystem......Page 984
Extending the Editor......Page 985
Editor Extension Points......Page 987
The Check Comment Highlighter Extension......Page 990
Summary......Page 996
Part XII: Visual Studio Ultimate......Page 997
Modeling Projects......Page 999
UML Diagrams......Page 1000
Using Layer Diagrams to Verify Application Architecture......Page 1004
The Architecture Explorer......Page 1006
Generate Sequence Diagram......Page 1008
Summary......Page 1010
Code Metrics......Page 1011
Lines of Code......Page 1012
Excluded Code......Page 1013
Managed Code Analysis Tool......Page 1014
Profiling Tools......Page 1015
Configuring Profiler Sessions......Page 1016
Reports......Page 1017
Standalone Profiler......Page 1018
IntelliTrace......Page 1019
Database Schemas......Page 1020
SQL-CLR Support......Page 1022
Database Refactoring......Page 1024
Schema Compare......Page 1025
Transact-SQL Editor......Page 1026
Summary......Page 1027
Automated Tests......Page 1029
Web Performance Tests......Page 1030
Load Tests......Page 1033
Coded UI Test......Page 1034
Relating Code and Tests......Page 1035
Code Coverage......Page 1036
Microsoft Test Manager......Page 1038
Testing Center......Page 1039
Lab Center......Page 1041
Summary......Page 1042
Chapter 57: Team Foundation Server......Page 1043
Process Templates......Page 1044
Work Item Queries......Page 1047
Work Item State......Page 1049
Excel......Page 1050
Version Control......Page 1051
Working from Solution Explorer......Page 1052
Check In......Page 1053
Resolve Conflicts......Page 1054
Working Offline......Page 1055
Label......Page 1056
History......Page 1057
Annotate......Page 1058
Branch......Page 1059
Merge......Page 1060
Team Foundation Build......Page 1061
Reporting and Business Intelligence......Page 1063
Process Guidance......Page 1064
Dashboards......Page 1065
Summary......Page 1066
Index......Page 1067
Advertisement......Page 1101

Polecaj historie