Visual Studio Hacks

Book description

With start-up templates for projects ranging from Windows applications to web services, and extensive help and on-line documentation, Visual Studio .NET might be mistaken for a tool for unsophisticated users. It's true that most developers soon discover that the basic operation of Visual Studio is fairly self-explanatory; less obvious are some of the suite's more advanced built-in features.Visual Studio .Net includes a wealth of little-used capabilities, is very customizable, has a complete automation model, and much more. On top of its regular feature set, there are hosts of free add-ins, macros, and power toys that can further enhance the functionality of Visual Studio. This book is all about exploring these things, and in doing so, becoming a better and more efficient developer. Developers will learn how to:

  • Get the most out of projects and solutions, including getting down and dirty with the undocumented format of project and solution files
  • Use these editor features to the fullest, and add additional functionality to the editor through the use of third-party add-ins
  • Learn smarter ways to navigate the application and your own source code
  • Customize shortcut keys, toolbars, menus, the toolbox, and much more
  • Use the debugger successfully not only on your source code, but with T-SQL and scripting languages as well
  • Automatically generate code
  • Learn how the server can be used to interface with databases, services, and performance counters, as well as WMI
  • Use and create Visual Studio add-ins to extend its functionality
Offering valuable tips, tools, and tricks, Visual Studio Hacks takes you far beyond the suite's usual capabilities. You can read this book from cover to cover or, because each hack stands its own, you can feel free to browse and jump to the different sections that interest you most. If there's a prerequisite you need to know about, a cross-reference will guide you to the right hack.If you want to experience the full spectrum of Visual Studio's functionality and flexibility, you'll find the perfect guide for exploration in Visual Studio Hacks. Once the final page is turned, you can confidently say that you've been exposed to everything that Visual Studio .NET is capable of doing.

Publisher resources

View/Submit Errata

Table of contents

  1. Contents
  2. Credits
    1. About the Author
    2. Contributors
    3. Acknowledgments
  3. Preface
    1. Why Visual Studio Hacks?
    2. How to Use This Book
    3. An Important Note About Keyboard Shortcuts
    4. How This Book Is Organized
    5. Conventions
    6. Using Code Examples
    7. Safari Enabled
    8. How to Contact Us
    9. Got a Hack?
  4. Master Projects and Solutions
    1. Manage Projects and Solutions
      1. Solutions
        1. Creating a solution
        2. Solution settings
      2. Projects
        1. Create a project
        2. Project settings
      3. Temporary Projects
      4. AutoSave and AutoRecover
    2. Master Assembly and Project References
      1. Assembly References
        1. How the list is created
        2. How references are resolved
        3. Managing .NET references
      2. Project References
    3. Organize Projects and Solutions
      1. Working with Multiple Solutions
      2. Project Division
      3. Enterprise Templates
    4. Hack the Project and Solution Files
      1. Solution Files
      2. Project Files
      3. Project and Solution File Conversion
    5. Remove SourceSafe Bindings
      1. Removing Bindings
      2. Hacking the Hack
  5. Master the Editor
    1. Master the Clipboard
      1. Clipboard Ring
      2. Line-Based Cut and Paste
      3. Block Selection
    2. Make Pasting into Visual Studio Easier
      1. Paste as String/StringBuilder
      2. Paste as Comment
      3. Paste as Region
      4. Configuration
        1. Line breaks
        2. AppendFormat on StringBuilder
      5. Key Bindings
    3. Master IntelliSense
      1. Complete Word
      2. Parameter Info
      3. Quick Info
      4. Stub Completion
        1. Interface
        2. Overriding methods
        3. Event handlers
      5. IntelliSense Comments
      6. See Also
    4. Master Regions
      1. C# Regions
      2. VB.NET Regions
      3. Region Strategy
      4. The Regions Add-in
    5. Add Guidelines to the Text Editor
    6. Select the Best Editor
      1. So Many Editors
        1. Text Editor
        2. HTML/XML Editor
        3. Other editors
      2. Choosing Your Editor
      3. Use a Third-Party Editor
    7. Customize Syntax Coloring
      1. Hacking the Hack
      2. Add Coloring for Other Languages
    8. Edit the Most Recent File and Project Lists
      1. Modify Number of Items
      2. Editing Most Recent Lists
    9. Refactor Your Code
      1. Extract Method
      2. Rename
      3. Encapsulate Field
      4. Extract Interface
      5. Parameter Functions
      6. Want It Now?
    10. Use and Share Code Snippets
      1. Insert Code Snippets
      2. Add Your Own Code Snippets
  6. Navigating Visual Studio
    1. Take Control of Your Workspace
      1. Window Management
        1. Dockable
        2. Floating
        3. Hidden
        4. Auto hide
        5. Tabbed document
      2. Window Layouts
      3. Document Window
      4. Work with Tabs
      5. Work with Panes
        1. Split-pane mode
      6. Full-Screen Mode
    2. Find Files Quickly
      1. Find Files
      2. Exclude Files
      3. Highlight Files
      4. Shortcut
    3. Search Files Quickly
    4. Search for Patterns in Your Files
      1. Searching
      2. Basic Expressions
        1. Matching quantities
        2. Preventing matches
      3. Basic Replacements
      4. Advanced Patterns
        1. Shortcuts
        2. Positional characters
        3. Escaping characters
        4. Example expressions
      5. Regular Expressions in Your Code
      6. See Also
    5. Navigate Your Source Code
      1. Navigation Shortcuts
        1. Navigation history
        2. Mouseless scrolling
        3. Go-to brace
        4. End and Home
      2. Bookmarks
    6. Never Forget a TODO Again
      1. Comments
      2. Custom Comments
    7. Hack the Mouse
    8. Enhance the Tabs in Visual Studio
  7. Customizing Visual Studio
    1. Create Your Own Shortcuts
      1. Adding a Custom Keystroke
      2. Hacking the Hack
    2. Customize Menus and Toolbars
      1. Customize Toolbars
        1. Modify existing toolbars
        2. Adding new toolbars
      2. Customize Menus
      3. Reset Changes
      4. Hacking the Hack
    3. Create Custom Window Layouts
      1. Hacking the Hack
    4. Customize the Toolbox
      1. Controls and the Toolbox
      2. Code Snippets and the Toolbox
      3. Hacking the Hack
    5. Package Your Toolbox Settings
    6. Add Support for Nonstandard File Extensions
    7. Hack the Registry
      1. Registry Settings
      2. Moving Registry Settings
      3. Use an Alternate Registry Tree
    8. Save and Move Your IDE Settings
    9. Enable IntelliSense for HTML and XML Documents
      1. Basic Structure of an IntelliSense Schema
        1. Header
        2. Names
        3. Types
      2. Considerations for Application Configuration Files
      3. Considerations for Custom Controls
      4. Installing the Schema
      5. Referencing the Schema
        1. Application configuration files
        2. ASPX files
    10. Add an External Tool
      1. External Tool Arguments
      2. External Tool Options
    11. Customize Your Project Build Process
      1. Pre- and Post-Build Event Commands
      2. Handling Build Events
        1. Canceling a failed build
        2. Alert the user on a successful build
    12. Modify the Build Output and Navigate the Results
      1. Modifying the Build Output Results
      2. Navigate Build Results with the Output Window
  8. Debugging
    1. Set Breakpoints
      1. Enter Break Mode Whenever a Particular Line of Code Is Reached
      2. Enter Break Mode When a Function Is Called
      3. Review Breakpoints in the Breakpoints Window
      4. Break Only on Certain Conditions
      5. Control How Often to Break on a Breakpoint
    2. Troubleshoot Breakpoints
    3. Customize Visual Studio’s Reaction to Exceptions
      1. Use the Exceptions Dialog Box
      2. Add Custom Exceptions
      3. Quickly Finding Exception Names
    4. Debug Scripting Code
    5. Debug SQL Server
      1. Running Remote
    6. Debug a Running Process
      1. Attaching to a Process
      2. Debug ASP.NET Applications Quickly
      3. Special Considerations for Services
      4. Detaching from a Process
      5. Hacking the Hack
    7. Debug a Failing Application
      1. Using JIT Debugging
      2. Windows Forms JIT Debugging
      3. JIT Settings
    8. Write a Custom Visualizer
      1. Write Your Own
        1. Create the visualizer form
        2. Create the Visual Studio interface
        3. Telling Visual Studio about the visualizer
        4. Deploy the visualizer
        5. Visualizer in action
  9. Speed Hacks
    1. Speed Up Visual Studio
      1. Disable the Start Page
      2. Turn Off Dynamic Help
      3. Start from the Run Dialog
      4. Keep MRU Lists Under Control
    2. Load Files from the Command Prompt
    3. Master the Command Window
      1. Command Window Basics
      2. Debugging with the Command Window
      3. Create Window Aliases
      4. View and Edit Command Window Aliases
    4. Build a Custom Tool
      1. Write the Code
      2. Add the Tool to Visual Studio
      3. Running the Tool
    5. Extend the Application Configuration File
      1. Building the Configuration Template
      2. Running the ConfigBuilder
      3. Using the Code
    6. Generate Strongly Typed DataSets
      1. Let Visual Studio Help
      2. Using the xsd.exe Tool
    7. Define Templates for Generating Code
      1. Creating a Template
      2. Creating the XML
      3. Execute in Visual Studio
    8. Create a Macro
      1. Recording Macros
      2. Creating Macros from Scratch
      3. Adding a Toolbar Button
      4. Creating a Keyboard Shortcut
      5. Sharing Macros
      6. See Also
    9. Generate Code with Macros
      1. Creating a Simple Generation Macro
        1. Recording a code template
        2. Generalizing the macro
        3. Resulting code
    10. Create Connection Strings Quickly
    11. Quickly Sign Assemblies
    12. Update Project References Quickly
    13. Automatically Add using and Imports Statements
    14. Insert Commonly Used Code Automatically
    15. Move Quickly Between Source Control Providers
  10. Help and Research
    1. Get Help
      1. Press F1 for Help
      2. Dynamic Help
      3. Contents and Search
      4. Visual Studio 2005 Help System
        1. How do I?
      5. Online Search
      6. Use Safari from Help
    2. Search the Internet from Visual Studio
    3. Redirect Help to Google
    4. Use P/Invoke with Ease
      1. Using PInvoke.NET
      2. Using the Add-in
    5. Examine the IL Generated by Your Code
      1. Microsoft Intermediate Language Disassembler (ILDASM)
      2. Advanced ILDASM
    6. Examine the Innards of Assemblies
      1. Download and Run Reflector
      2. Disassemble Assemblies with Reflector
      3. Additional Reflector Features
      4. Using Reflector Within Visual Studio
    7. Follow the Rules with FxCop
      1. Create an FxCop Project
      2. Analyze Your Assemblies
      3. Fix a Message—and Watch It Disappear
      4. A Look at the Rules
      5. Visual Studio Integration
      6. More FxCop Resources
    8. Generate Statistics on Your C# Code
      1. Download and Install devMetrics
      2. Study the Report
    9. Profile Heap Allocations
  11. Comments and Documentation
    1. Master C# XML Comments
      1. Primary Tags
      2. Secondary Tags
        1. and
        2. List tags
        3. Custom tags
      3. Creating the XML File
    2. Create Comments Faster
      1. GhostDoc
        1. Documentation for an indexer
        2. Boolean properties with a name consisting of only one word
        3. A method with “of the” reordering for method and parameter names
      2. Getting Started
      3. Tweaking GhostDoc
    3. Create XML Comments with VB.NET
      1. Using VBCommenter
      2. Configuring VBCommenter
      3. Hacking the Hack
    4. Create Documentation from XML Comments
      1. Using NDoc
    5. Integrate Your Own Documentation into Visual Studio
      1. Create Documentation with NDoc
      2. Registering Your Help File
      3. Include Your Help Collection
  12. Server Explorer Hacks
    1. Access Performance Counters
      1. Counter Information
    2. Diagram and Modify a Database
      1. Database Diagrams
      2. Tables
      3. Views
      4. Stored Procedures
    3. Script Your Database
      1. The Database Project
        1. Create a Database Project
        2. Create scripts
        3. Create command file
    4. Enumerate Processes, Drives, Shares, and More
      1. Adding Classes
      2. Creating Managed Classes
  13. Work with Visual Studio Tools
    1. Master the Visual Studio Command Prompt
      1. Add the Visual Studio Command Prompt as an External Tool
      2. Add the Visual Studio Command Prompt to the Explorer
      3. See Also
    2. Launch Visual Studio from the Command Prompt
      1. Setting Fonts
      2. Execute a Command
      3. Run a Solution
      4. Building Projects and Solutions
      5. Other Switches
    3. Stress Test Web Applications
      1. Stress Testing Configurations
      2. Identifying Test Cases
      3. Create an ACT Project
      4. Creating a Test
      5. Test Properties
        1. Duration example
        2. Iterations example
      6. Running a Test
      7. Viewing Test Results
      8. Customizing Test Scripts
      9. ACT Project Files
      10. ACT: The Standalone Tool (1/2)
      11. ACT: The Standalone Tool (2/2)
        1. Create an ACT Project
        2. Creating new tests
        3. A sample ACT Project
        4. Test properties
        5. Defining users
        6. Running a test
        7. Viewing the results
    4. Obfuscate Your Code
      1. Create a Dotfuscator Project
      2. Build the Dotfuscator Project
      3. Investigate the Results with ILDASM
      4. Investigate the Results with Reflector
    5. Generate Code from UML
      1. A Simple Class Diagram
      2. Generate the Code
      3. View the Code
      4. Hacking the Hack
        1. Create a new class template
        2. Create a new property (attribute) template
        3. Regenerate your code and view it
    6. Generate UML Design Documents from Code
      1. Reverse Engineer Your Code
      2. Create Your Class Diagram
  14. Visual Studio Tools for Office
    1. Install Visual Studio Tools for Office 2003
      1. When You Deploy
      2. Considerations
        1. Handling optional parameters
        2. Closing the debugger closes Office application
        3. COM-based assemblies still return COM-based HResults
    2. Create a Command Bar in Word 2003
      1. Create the Command Bar
      2. Handle the Command Bar Events
    3. Display a Windows Form from Excel 2003
      1. Create a Windows Form
      2. Initialize the Windows Form
      3. Gather Data with the Windows Forms
      4. Create a Chart in Excel
  15. Extending Visual Studio
    1. Automate Visual Studio
      1. Automate Documents
      2. Invoke Commands
      3. Automate Windows
    2. Access Visual Studio from Standalone Applications
      1. Version Issues
      2. The Notorious “Call Was Rejected by Callee” Error
    3. Create a File Template
      1. Create Your Own Template
      2. Visual Studio .NET 2003 Is Missing a Template
      3. Get Your Template Listed in the Add New Item Dialog
        1. VSZ Files
        2. VSDir Files
      4. Wizards Directory Structure
      5. HTTPHandler.ashx Template File
      6. Default.js Script
      7. Try It Out
    4. Writing a Visual Studio Add-in
      1. Create the Project
      2. Add Menu Item
      3. Write the Code
      4. Installation
    5. Find the Name of That Command Bar
      1. Install the Command Browser
      2. Run the Command Browser
    6. Change the Icon for Your Add-in
      1. Creating the Icon
      2. Modify Command Code
      3. Add to Installer
  16. Enhancing Visual Studio
    1. Manage Add-ins
      1. Installing Add-ins
      2. Add-in Manager
      3. Repairing Add-ins
    2. Run Unit Tests Inside Visual Studio
      1. Installing
      2. Run Test(s)
      3. Ad Hoc Tests
      4. Test Output and Task List
      5. Test With... Debugger
      6. Test Projects and Solutions
      7. Aborting a Test Run
      8. Stopping the Test Process
    3. Spellcheck Your Code and Comments
      1. Download and Install the Spellchecker Add-in
      2. Configure the Spellchecker Options
        1. Specify what types of content to search
        2. Indicate patterns that should be ignored or always considered misspelled
        3. Use different spellchecking rules for different file types
      3. Check for Spelling Errors
    4. View an Outline of Your Controls
    5. Blog Code from Visual Studio
      1. Convert to HTML with a Macro
      2. Convert to HTML with an Add-in
    6. Collapse and Expand Your Code
    7. Combine the Visual Studio Command Prompt and the Command Window
    8. Generate Web Services Code
      1. Generate Server-Side Interface
      2. Generate Client-Side Proxies
      3. ContractFirst Options
    9. Test Regular Expressions in Visual Studio
      1. Evaluate Regular Expressions
      2. Find More Regular Expressions
  17. Index (1/6)
  18. Index (2/6)
  19. Index (3/6)
  20. Index (4/6)
  21. Index (5/6)
  22. Index (6/6)

Product information

  • Title: Visual Studio Hacks
  • Author(s): James Avery
  • Release date: March 2005
  • Publisher(s): O'Reilly Media, Inc.
  • ISBN: 9780596008475