Tag Archives: VS2010-Tips

VS2010 Tips #15: Disable IntelliTrace for better debugging performance (VS2010 Ultimate Only)

I recently upgrading ASP.NET MVC 2 solution from Visual Studio 2008 to Visual Studio 2010 (Ultimate Edition). I found that debugging was very slow. Depending on project size, it took around 30 seconds to initialize and another 5 seconds on each page request in my experience.

I tried disabling IntelliTrace (what is IntelliTrace?)

image

and voila! it got its awesome performance back!

VS2010 Tips #14: How change the default browser used in debugging ASP.NET MVC 2 application

Changing default browser used in debugging ASP.NET MVC 2 is a bit tricky in Visual Studio 2010. To use ScottGu’s steps, you will need to add new ASPX page first. But unfortunately if you delete the page then close the application, anytime you rerun the application then the change you did will lost (it backs to use the default browser set in OS).

In my case I have Firefox set as my default browser but I need to use Internet Explorer as default browser for debugging. The trick I do is by doing these:

  1. Open the project properties
  2. Go to Web tab
  3. Set the Start Action to use Start external program and then pass the Internet Explorer executable path and the url as Command line arguments.
  4. Set the Servers’ specific port to the same port set in the url in step 3.

image

(click to view the image in original size)

Make donation to this article:


 

VS2010 Tips #13: How to do multi-targeting in Visual Studio 2010 Express edition

In my previous blog post I wrote that the requirement to enable multi-targeting feature in Visual Studio 2010 is .NET Framework 3.5 SP1 installed in the machine. But why does it not enable the Target Framework dropdown in File -> New -> Project / Web Site dialog of Visual Studio 2010 Express edition? Is multi-targeting not supported in Visual Studio 2010 Express edition?

Visual C# 2010 Express
image

Visual Web Developer 2010 Express
image

If you’re a Visual Studio 2010 Express edition user, unfortunately you cannot take advantage of the Target Framework dropdown in the File -> New -> Project / Web Site dialog (as specified in http://msdn.microsoft.com/en-us/library/bb398197.aspx). But it doesn’t mean that multi-targeting is not supported.

By default Visual Studio 2010 Express edition will create the projects with .NET Framework 4 targeted. To change the target framework you can do it from Project Properties (Solution Explorer -> [right click your project] -> Properties)

Visual C# 2010 Express
image

Visual Web Developer 2010 Express
image

Hope this helps.

VS2010 Tips #12: Patch for Cut/Copy “insufficient memory” issue in Visual Studio 2010

Visual Studio 2010 RTM has a bug in calculating available memory when developer try and do Cut or Copy text operations.

"Insufficient available memory to meet the expected demands of an operation at this time, possibly due to virtual address space fragmentation. Please try again later."

A patch available now for it that you can download from:
http://connect.microsoft.com/VisualStudio/Downloads/DownloadDetails.aspx?DownloadID=29729

More information about this issue and the patch can be found at:
http://blogs.msdn.com/b/visualstudio/archive/2010/06/25/patch-available-for-cut-or-copy-displaying-insufficient-memory-error-in-vs-2010.aspx

VS2010 Tips #11: Visual Studio 2010 Pro Power Tools extension

Visual Studio team has released Visual Studio 2010 Pro Power Tools extension. This is a great extension to increase your productivity and bring back some Visual Studio 2008 feature such as close button in the tab well.

Here is the description I copied from the extension page.

Visual Studio 2010 Productivity Power Tools

A set of extensions to Visual Studio Professional (and above) which improves developer productivity.

  • Document Well 2010 Plus (More Info)
    One of the key pieces of feedback that we have received over several versions of Visual Studio is that users want to be able to customize the behaviour of their document tabs.  From the ordering of tabs to the position of the close buttons, user can now configure dozens of different options for their tabs. Go to Tools -> Options -> Environment -> Document Tab Well to configure these options as you prefer:

    • Tab Well UI
      • Scrollable tabs
        Maintain spatial consistency of the documents that are included in the document well.
      • Vertical tabs
        Document tabs are shown vertically, allowing you to fit more tabs than are normally visible when shown horizontally.
      • Pinned tabs
        Allows you to pin tabs to keep them always visible and available.
      • Show close button in tab well
        Similar to Visual Studio 2008, will show a close button in the document well that will close the active tab.
    • Tab Behavior
      • Remove tabs by usage order (LRU)
        When a new tab is inserted and existing tabs don’t fit in the document well, instead of removing the tab at the end of the well it will remove the least recently used tab. This ensures that frequently used tabs are readily available.
      • Show pinned tabs in a separate row/column
        Pinning tabs can quickly cause you to run out of space for regular tabs. The option allows you to always show pinned tabs in a separate row (or column, if displayed vertically) from regular tabs.
    • Sorting
      • Sort tabs by project
        Tabs will be sorted by the project they belong to, thus keeping them always together in the document tab well.
      • Sort tabs alphabetically
        Tabs will be sorted alphabetically. When Sort By Project is turned on, tabs will be sorted first by project and then alphabetically.
      • Sort tab well dropdown alphabetically
        The drop down menu at the right end of the document well is sorted alphabetically. This option allows ordering as the tabs are laid out in the document well.
    • Tab UI
      • Color tabs according to their project or according to regular expressions
        This option permits tabs to be colored according to the project they belong to. This is particularly useful when sorting tabs by project, as it allows you to immediately identify different groups of project documents.
        You can also configure regular expressions and assign a color to each one. If the name of a tab matches the configured regular expression, it will be colored with the assigned color.
      • Miscellaneous options that modify tab UI
        • Show document/toolwindow icon in tab
        • Show close button in tab
        • Modify dirty indicator style
          This option allows you to select from a set of different dirty indicators that you might prefer over the asterisk.
        • Modify minimum and maximum tab size
          Allows you to modify minimum and maximum tab size. Try setting minimum and maximum sizes to the same value, and you will have evenly spaced tabs.
  • Searchable Add Reference Dialog
    The new Add Reference dialog makes it faster and easier for you to find the reference that you are looking for and add it to your VB, C# or F# project.  From the Solution Explorer, simply right click on the References node, select the Add Reference command to see the updated Add Reference Dialog. 
  • Highlight Current Line
    As the resolution of monitors increases, it’s becoming more difficult to find the caret in the code editor. The highlight current line extension makes it easy to find the caret by highlighting the line that the caret is on in the editor. You can even configure the default colour by changing the setting for “Current Line (Extension)” and “Current Line Inactive (Extension)” in Tools Options Fonts & Colors.
  • HTML Copy (More Info)
    This extension provides support for the HTML Clipboard format when copying code from the editor.  This means that you’ll no longer have to go fix up the formatting of your code when you paste it into a TFS bug form or any other HTML based control. 
  • Triple Click
    It’s never been easier to select a line of code from the mouse by simple triple-clicking anywhere on the line.
  • Fix Mixed Tabs
    Some developers prefer tabs, others prefer spaces, and nobody likes mixing tabs & spaces. This extension promotes developer harmony by warning as they are open or save a file that has a mixture of tabs & spaces. The information bar also provides an easy way to fix the file to suit your preference. 
  • Ctrl + Click Go To Definition
    This extension gives the editor a web browser by adding clickable hyperlinks to symbols in your code as you hold down the Ctrl key.
  • Align Assignments
    This extension is useful for making your code a little more readable by aligning the assignments when you type Ctrl+Alt+] such that it takes this:

    And turns it into this:

    Please note: This may conflict with your formatting settings. E.g. in C# you will need to disable: Tools->Options->Text Editor->C#->Formatting->Spacing->"Ignore spaces in declaration statements"
  • Colorized Parameter Help
    This extension improves consistency with the editor by applying syntax highlighting to the contents of the Parameter Help window for C# &VB.
  • Move Line Up/Down Commands
    This extension maps the Alt+Up Arrow & Alt+Down Arrow keys such that they will move the current line of code or the selected lines up and down through the editor.
  • Column Guides
    Since Visual Studio 2002, there has been a not so secret registry key which allowed user to draw a vertical line in the code editor.  This is very useful to remind developers that their full line of code or comments may not fit one a single screen. Thanks to this extension this feature has returned with UI configure it. Simply place the cursor at the appropriate column and select Add Guideline from the context menu.

When this post is written the version is 10.0.10608.1630 and it’s stable based on my experience.

Download it now for FREE at

http://visualstudiogallery.msdn.microsoft.com/en-us/d0d33361-18e2-46c0-8ff2-4adea1e34fef