Home
BBB Yahoo

Visual Studio 2010 Tips

By Robert John Stevens, CEO of WriteExpress Corporation

  • Run Visual Studio 2010 as administrator (with elevated privileges)—right click on icon and select Run as Administrator

  • Visual Studio Command Prompt Tools:

    1. MSBuild—a tool to build projects
    2. vbc—Visual Basic Compiler
  • How to create a solution—Click File > New Project > Other Project Types > Visual Studio Solutions

  • How to launch an application from a console window—Process.Start(filename)

  • Microsoft Open Source Website—CodePlex

  • Select a browser to run your code—Select a file from Solution Explorer, right click and select Browse With


Visual Studio 2010 Definitions

  • Object Browser—If you want to look at objects in compiled assemblies

  • Project—A container for files

  • Solution—Can contain many projects


Visual Studio Editor Tips

  • Enable word wrap—Tools > Options > Text Editor > All Languages > Word Wrap

  • Choose default settings for language environments—Click Tools > Import and Export Settings Wizard > No, just import settings, overwriting my current settings

  • Class View or Class Designer—If you want to look at objects in your own code

  • Comment Code—Ctrl+E, Ctrl+c (c for comment)

  • Comment syntax for task list—//TODO

  • Context-sensitive Help—Highlight something and press F1

  • Create a click-once installer—In the Solution Explorer, double click on the Properties node. Go to the Publish section. Click on the Publish Wizard.

  • Complete a code snipet: Press tab twice (i.e. after typing if for an if statement

  • Complete a code property snippet—Type "prop" and then tab twice and you'll get a getter and setter stub.

  • Complete intellisense—Ctrl+Spacebar

  • Create a release build—Change the menu from Debug to Release

  • Create regions—Type #region and #endregion around code

  • Find all references—Right click on a method and select Find all References

  • Find matching braces— Change their color: Tools > Options > Environment > Folds and Colors > select Brace Matching (Rectangle) and change its color

  • Format document—Edit > Advanced > Format Document (Ctrl+E, Ctrl+d)

  • Generate method or field stubs (on undefined items)—Ctrl+Period

  • Go to matching brace—Put cursor on an opening brace and press Ctrl + ]

  • Install a 3rd party extension—Tools > Extension Manager

  • Navigate to a declaration—Put your cursor on a label and press F12

  • Refactor code in VB—Install CodeRush Xpress

  • Remove unused using statements (on top of your code page)—Right click on using statements. Organize Usings > Remove and Sort

  • Restore a window to its former position—Ctrl + Double click the window's title bar

  • Restore all windows to their original position—Click Window > Reset Window Layout

  • Show all windows—Ctrl-Tab

  • Show line numbers—Tools > Options > Text Editor > All Languages > Line Numbers

  • Split a view or create another visual copy of your open file—Open a file in a tab. Click Window > New Window

  • Toggle breakpoint—F9

  • Uncomment Code—Ctrl+E, Ctrl+u (u for uncomment)

  • Unsplit a split view—Double click on the top line

  • View call hierarchy (see all the calls to a method)—Right click on a method and select View Call Hierarchy

  • Zoom in and out—Ctrl + mouse wheel


Visual Studio Help Generation Documentation

Install three open source programs:

  • Sandcastle.msi—Help generation tool from Microsoft that works on the command line

  • SandcastleBuilderSetup.msi—Graphics interface that works with Sandcastle

  • GhostDoc.msi—Plugin for Visual Studio that helps you write the XML comments you need. Once installed, put your cursor on a method declaration and click Tools > GhostDoc > Document this

You generate XML comments. Visual Studio stores these comments in a separate XML file. This XML file is used by the Help tools to generate documentation.

To documement a method, you type three commment slashes.

Ctrl+Shift+Spacebar activates the new Help for the method your cursor is on.

To generate your Help file, double click on Properties in the Solution Explorer. Click Build. In the Output section, click the XML documentation file checkbox. Next time you Build your project it will generate an XML file. Run the Sandcastle Help File Builder Gui program. File > New Project. Name your project and save it. Change the Project Properties > WorkingPath so it is a folder other than your Desktop that won't be erased. Load your XML file (). Next, tell it where to find the XML file. In the Project Explorer, right click on Documentation Sources. Click Add Documentation Source. Select your XML file. Click Open. Click Documentation > Build Project. It generates a .chm file for you.


Visual Studio Code Generation Tools


Programming Bing


C#

  • Named Parameters: eg. Foo(IsFunction:true)


Silverlight



Copyright © 2011 Robert Stevens. All rights reserved.

This article was commenced on November 22, 2010. Last update: November 22, 2010.


Ad by Google

© 1996-2011 WriteExpress Corporation. All rights reserved.
WriteExpress®, Rhymer® and Unblocking Writers' Block® are registered trademarks of WriteExpress Corporation.