Blog - Title

Visual Studio 2013 Current Status

  • The Ultimate Visual Studio Tips and Tricks Blog

    Visual Studio 2012 New Features: Compatibility (aka Project Round-Tripping)




    Now that Visual Studio 2012 is pretty well baked I thought it would be good to start revisiting some of my favorite features again and introduce new ones.  Since project round-tripping is one of my most favorite features I thought we would start with it. 


    The Dark Ages

    In all prior incarnations of Visual Studio if you had an older version, VS2008 for example, and opened up the project in a newer version, VS2010 in this case, you had the option to convert the project.  If you did the conversion it was a one-way trip.  You couldn’t open the project again in VS2008 if you tried to go back.  This has been the source of a lot of pain and suffering for developers who have to work with multiple versions of Visual Studio for a long, long time.  We want the cool features of the latest IDE but still want others on our team to be able to open the solution in the older version of Visual Studio when they get the files from source control.


    The Information Age

    Visual Studio 2012 changes the game.  You can now create projects in Visual Studio 2010 with Service Pack 1 then open those projects in Visual Studio 2012 and THEN open the project up again in VS2010 SP1.  This works the other way, too!  You can create projects in VS2012 (targeting Framework version 4 or less) then open the project in VS2010 SP1 and THEN open it up in VS2012 again. In other words, we now have project round-tripping capability so you can work with the latest features but still keep the solution compatible with team members using an older version of Visual Studio.


    Putting it to the Test

    Here are the steps you can take to test this for yourself:

    1. Create a compatible project (see fine print below) in Visual Studio 2010 with Service Pack 1 and put in a little sample code.
    2. Save and close the solution.
    3. Open the solution (CTRL + SHIFT + O) in Visual Studio 2012 and add some more code.  Notice there is no longer a prompt to convert the project that appears.
    4. Save the close the solution.
    5. Open the project up again in VS2010 SP1 and enjoy project round-tripping.


    The Fine Print

    As you probably guessed by now this doesn’t work with every project type and there are some limitations based on the project type you use.  For the full list of project types and limitations you can go here:


    Here is an edited list of the ones you are most likely to use:

    Type of Project


    C#/Visual Basic Silverlight 4 or 5 Application or Class Library

    If you allow Visual Studio to update the project automatically, you can open it in either Visual Studio 2012 RC or Visual Studio 2010 with SP1.

    C#/Visual Basic Webform or Winform

    You can open the project in both Visual Studio 2012 RC and Visual Studio 2010 with SP1.

    Coded UI test

    If you allow Visual Studio to update the project automatically, you can open it in both Visual Studio 2012 RC and Visual Studio 2010 with SP1. For more information, see Upgrading Tests from Earlier Versions of Visual Studio.

    Model-View-Controller framework

    If the Model-View-Controller (MVC) project uses version 3 or 4, you can open this project in Visual Studio 2012 RC. By default, Visual Studio 2010 with SP1 supports only MVC 2 and 3, and Visual Studio 2012 RC supports only MVC 3 and 4.

    For information about how to automatically upgrade from MVC 2 to MCV 3, see ASP.NET MVC 3 Application Upgrader. For information about how to manually upgrade from MVC 2 to MVC3, see Upgrading an ASP.NET MVC 2 Project to ASP.NET MVC 3 Tools Update. If your project targets the .NET Framework 3.5 with SP1, you must retarget your project to use the .NET Framework 4.

    MSI setup (.vdproj)

    You can’t open this project in Visual Studio 2012 RC because it doesn't support that project type. We recommend that you use InstallShield Limited Edition for Visual Studio (ISLE), a free deployment solution that directly supports most Windows platforms and application runtimes. ISLE also supports importing data and settings from Visual Studio Installer projects. For more information, see Windows Installer Deployment.

    Office 2010 VSTO

    If the project targets the .NET Framework 4, you can open this project in both Visual Studio 2012 RC and Visual Studio 2010 with SP1.

    SharePoint 2010

    You can open the project in both Visual Studio 2012 RC and Visual Studio 2010 with SP1.

    SQL Server 2008 R2 Express

    If SQL Server 2008 R2 Express is installed on the computers that are running Visual Studio 2012 RC and Visual Studio 2010 with SP1, you can open the project in both of those versions of Visual Studio.

    SQL Server Report Project

    You can open the project in both Visual Studio 2012 RC and Visual Studio 2010 with SP1. For local mode only (that is, when not connected to SQL Server), you won’t get the design-time experience for controls that are associated with the viewer in Visual Studio 2010, but the project will function correctly at runtime.

    Caution note Caution

    If you add a feature that’s specific to Visual Studio 2012 RC, the report schema will be upgraded automatically, and you will no longer be able to open the project in Visual Studio 2010 with SP1.

    Unit tests

    You can use Microsoft Test Manager 2010 with SP1 in Visual Studio and Visual Studio 2012 RC to open tests that were created in either of these versions. For more information, see Upgrading Tests from Earlier Versions of Visual Studio.

    Visual C++

    If Visual Studio 2012 RC and Visual Studio 2010 with SP1 are installed on the same computer, you can open the project in both of those versions of Visual Studio. For more information, see How to: Upgrade Visual C++ Projects to Visual Studio 2012.

    Visual Studio 2010 web

    If you allow Visual Studio to upgrade the project automatically, you can open it in both Visual Studio 2012 RC and Visual Studio 2010 with SP1.

    Visual Studio 2010 Database (.dbproj)

    If you convert the project to a SQL Server Data Tools Database project, you can open it in Visual Studio 2012 RC. However, Visual Studio 2012 RC doesn’t support the following artifacts:

    • unit tests

    • data-generation plans

    • data-comparison files

    • custom rule extensions for static code analysis

    • server.sqlsettings

    • .sqlcmd files

    • custom deployment extensions

    • partial projects (.files)

    If you install SQL Server Data Tools, you can open the project in Visual Studio 2010 with SP1 after the migration. For more information, see Microsoft SQL Server Data Tools.

    VS 2010 SQL Server Data Tools

    You can open this project in both Visual Studio 2012 RC and Visual Studio 2010 with SP1.

    Visual Studio Lab Management

    You can use Microsoft Test Manager in Visual Studio 2010 with SP1 or Visual Studio 2012 RC to open environments that were created in either of these versions. However, your version of Microsoft Test Manager must match your version of Team Foundation Server before you can create environments. For more information, see Upgrading Lab Management Components from Visual Studio 2010.

    Visual Studio SDK/VSIX

    If you upgrade the project, you can open it in Visual Studio 2012 RC only. For more information, see How to: Upgrade Visual Studio SDK/VSIX Projects to Visual Studio 2012.

    Windows Communication Foundation, Windows Presentation Foundation

    You can open this project in both Visual Studio 2012 RC and Visual Studio 2010 with SP1.

    Windows Mobile

    You can’t open this project in Visual Studio 2012 RC because it doesn't support the project type.

    Windows Phone

    You can’t open this project in Visual Studio 2012 RC because it doesn't support the project type.


    You can open most other types of projects in both Visual Studio 2012 RC and Visual Studio 2010 with SP1.


    For a more detailed explanation of why this is the case and how the decision making process was done by the VS team make sure to read Richa Prasad’s most excellent blog post here:


    Richa does a great job of explaining the overall decisions around this feature as well as showing what happens (and what you can expect to see) in those scenarios where it isn’t as clean. 


    For example, here is what you would see when trying to import a setup project that is no longer supported:



    And here is the resulting migration report generated by Visual Studio 2012:



    And there you have it!  Give project round-tripping a shot yourself and see if you think it’s great, too!

  • The Ultimate Visual Studio Tips and Tricks Blog

    Visual Studio 2012 New Features: Solution Explorer


    I love the title of this one because I’m sure someone will read this and wonder why I think Solution Explorer is a “new” feature.  I mean, haven’t we had this sucker for a billion years?  Aren’t there cave drawings in France about this feature?  So why is it “new”?  Let me show you!


    Search Solution Explorer (CTRL + ;)

    First and foremost, you can now search Solution Explorer!  I’ve been wanting a feature like this since before Solution Explorer was even invented back in my VB 3 days (about 19 years ago).  Here is what things looked like back then:



    And from then until Visual Studio 2010 we STILL couldn’t search items:



    But now you can!  Just type in any search term into the Search Solution Explorer textbox:



    And it will find anything that contains the search term in it:



    You can filter the search to choose how broad the search goes by clicking on the drop down arrow to the far right of the Search Solution Explorer textbox:

    (NOTE: searching within file contents doesn’t mean what you think it means.  See the section “More Than Physical” for information)



    One other cool feature is you can have Solution Explorer only show you the currently open files by clicking the drop down button just to the right of the Home button:




    More Than Physical

    In the past, Solution Explorer was relegated to only showing physical elements or those things that help contain / organize those elements (i.e. solution folders).  That’s out the window, too.  Now the experience doesn’t stop at the physical level but extends to logical elements as well:



    Which makes searching even more awesome:



    If you are using the Preview Tab then clicking on any item in Solution Explorer will go to the file and highlight code if applicable BUT you can’t double click the logical item to open the file for some reason and instead have to double click the filename to open it.




    Navigation is much improved as well. 


    Browser-Like Movement

    After a doing a search, like the one shown above, you can click the Home button:



    And Solution Explorer will go back to “normal”:



    Clicking the Back button:



    Takes me back to the search I just did:



    Here is the weird part:  If I reuse the search box and type another search right away it doesn’t remember the previous search I did and I can’t go back; BUT if I click Home between searches then it remembers all my old searches.  I’ve tested this up to 12 entries and it works fine as long as you remember to click Home between searches.


    Sync with Active Document

    Occasionally you may be looking at a file but Solution Explorer isn’t on that file.  When this happens a button appears that allows you to sync Solution Explorer with the document you are currently in so you can see where it is in the project structure.



    Right Click Experience

    The right click experience is, to say the least, incredible!  Depending on what you select the context menu changes appropriately.  So if I right click a code file this is what I get:



    But if I right click a class this is what I get:



    And this is the context menu for a method:



    Each option changes the view in Solution Explorer to better examine relationships.  The bottom line:  make sure to check out your context menus to change the elements you are viewing in Solution Explorer.



    New Solution Explorer View

    There used to be a button for creating a new instance of Solution Explorer which was excellent for multi-monitor viewing of code:



    The button is gone now (which is a mistake in my opinion) and you can no longer get an entire copy of Solution Explorer in a new window BUT you can get a copy of any project or file in a new Solution Explorer window which is what I have done in the example above.  Just right click any project/file and choose New Solution Explorer View:




    Team Foundation Server

    If you are using TFS then you can filter Solution Explorer to show you files with Pending Changes:



    And there you have it!  As you can see there are quite a few changes in the new, improved Solution Explorer so go explore!

  • The Ultimate Visual Studio Tips and Tricks Blog

    TODO Comments in the Task List


    Versions:  2008,2010
    Published:  6/7/2010
    Code:  vstipTool0029


    Ever been writing some code and you want to leave a reminder to yourself to do something on a particular line or area?  Did you know about the "to do" comment feature?  It seriously rocks if you have never used it AND, because it goes in the source code, everyone can have access to the information when you do you check-in!


    So here's how it works:  In VB you just put any comment in that begins with the letters "todo" (case doesn't matter):



    In C#, it's pretty much the same thing (again, case doesn't matter):



    C++ requires that the “TODO” be in upper-case or it will not show up in the Task List:




    In C++ for VS2010 you have to explicitly turn this feature on.  Go to Tools | Options | Text Editor | C/C++ | Formatting | Miscellaneous and change Enumerate Comment Tasks to true:




    Regardless which language you use the result is a nice entry in your Task List:



    NOTE:  In order to see these items, you have to click the drop-down list in the Task List and choose Comments as shown here.

  • The Ultimate Visual Studio Tips and Tricks Blog

    GREP and SED with PowerShell



    So...I like GREP and SED from my old UNIX days and am VERY happy to see that PowerShell can do the same type of functionality with a lot more power in most cases.  I though some of you might like some really simple examples of how to take a text file and do GREP-ish and SED-ish actions.



    cat somefile.txt | where { $_ -match "expression"}


    The command above will search each line of "somefile.txt" to see if it contains the regular expression "expression" and return the entire line if there is a match.






    cat somefile.txt | %{$_ -replace "expression","replace"}


    The command above will search each line of "somefile.txt" for the regular expression "expression" and replace it with the string "replace".






    Mary had a little lamb,

    It's fleece was white as snow,

    But the lamb made Mary mad,

    So she ate it.




    cat DATA.TXT | where { $_ -match "Mary"}


    returns the following:

    Mary had a little lamb,

    But the lamb made Mary mad,




    cat DATA.TXT | % { $_ -replace "Mary","Susan" }


    returns the following:

    Susan had a little lamb,

    It's fleece was white as snow,

    But the lamb made Susan mad,

    So she ate it.


    ================ Edit 7/14 ==================== 

    A question came up the the other day about putting these results into another text file.  Using redirection this is quite easy.  Here is how it is done:


    cat DATA.TXT | % { $_ -replace "Mary","Susan" } > newfile.txt



    enjoy :)


  • The Ultimate Visual Studio Tips and Tricks Blog

    LINQ and Stored Procedures


    Okay so last quarter I was asked if you can call stored procedures using Language Integrated Query (LINQ).  The answer, of course, is YES!  It would be kind of silly if we didn't include this type of functionality. :P


    NOTE:  You need the following items to do this example

    SQL Server (pretty much any version will do but this example uses 2005)

    Visual Studio 2008 (Beta 2 was used for this example)

    A little time to sling some code



    So how exactly DO you call a stored proc using LINQ?  Easy just follow these simple steps:

    1. Create a new Windows Forms Application in Visual Studio 2008, let's call it "LINQ_SP_Coolness"

    2. Next, make sure you have a connection to some data source in your Server Explorer.  You may need to add a new connection.

    3. For the purposes of this discussion I am using the Northwind Database on SQL Server.

    4. Take a look at the existing stored procedures because what you need may already be there.

    5. Aaaaaand since I'm bored watching re-runs tonight, why don't we make our own stored procedure?

    6. Just write a simple SELECT to yank out some data AND remember to save :)

    7. Just to make sure, refresh the stored procedure folder on your data source in Server Explorer to see your shiny, new stored proc listed...

    8. You might even want to test it :P

    9. To get this to a point we can manipulate it using LINQ we need to have our classes and mappings in place.  Fortunately, this is a VERY easy thing to do.  Just right-click your project, choose Project...Add New Item from the Menu Bar.  Let's add a "LINQ to SQL Classes" item with the default name of "DataClasses1.dbml".

    10. Click and drag the stored procedure from Server Explorer on to the LINQ design surface.

    11. You should see the procedure showing up on the upper right of the design surface.

    12. Now let's slap some controls on our Windows Form.  How about a list box and a button?  Live on the edge!

    13. Now we need to work with database by establishing a context to it.  Next, we need to create a query expression that treats the result of the stored procedure as a table and query against it selecting only the LastName column.  Just for fun why don't we sort all the last names as well?  Finally, we will take the list of names returned and loop through them adding each one to our listBox as we go along.

      Double-click on the button to code for the Click event and write the following lines of code:
      (NOTE: make sure to substitute your server name in place of "zero_cool" and if you are using SQL Express you need to modify the server piece to read like this "SQLEXPRESS\myserver")

    14. If all goes well, you should get the following result:

    15. And that's how you use a stored procedure with LINQ.  This was a very simple example but if you really want to see a great series on LINQ go to my buddy Benko's site.   He has a webcast series on LINQ that kicks major butt! :)

      [Updated:  added tags]
  • The Ultimate Visual Studio Tips and Tricks Blog

    Visual Studio 2013 Preview: CodeLens aka Code Information Indicators


    [Updated: 7/12/2013: Thanks to John Gardner for the updated info.]


    There is only one way to describe this next feature: IT ROCKS!


    To use this feature you will need Visual Studio 2013 Preview and Team Foundation Server 2013 Preview as some information comes from TFS.



    Presenting the Problem

    For me, this is the signature feature in Visual Studio 2013. It’s well thought out and solves multiple issues we face as developers. But what IS it exactly? The best way to demonstrate it is to remind you what life was like before we had it. Here is a method (from the TailSpin toys sample code) the way we have seen it in the past:

    5-16-2012 6-04-11 PM


    What if I need to find all the references to this method? I can press SHIFT+F12 and get results in the Find Symbol Results window:

    5-16-2012 6-09-48 PM


    How about the tests associated with this method? I’d either dig through the references above or dig into the Test Explorer window and see what I can find. But what if I want to know who last changed this method? How about the number of times this code has changed? Now I have to dig into other windows to locate the data. In short, I can get all the information I need but have to go to several different places to get it.



    Solving the Problem

    The Visual Studio team has come up with an elegant solution to the problem: show information about the code WITH the code. It’s a great addition to the development experience. Originally called Code Information Indicators, the marketing folks have now dubbed this CodeLens.


    Turning It On

    CodeLens is on by default but I want to point out the information you can choose to view. Go to Tools | Options | Text Editor | All Languages | Code Information Indicators:

    5-16-2012 6-29-59 PM

    (NOTE: a faster way to get here is to press CTRL+Q for QuickLaunch and type the word “information” into the search area then select the Code Information Indicators entry)


    I’ll show these in the order you will most likely see them when you begin using this feature.




    Show References

    5-16-2012 6-38-10 PM

    The first indicator you will typically notice is the references. This is just like using Find All References but instead of presenting the information in another window a summary of references is shown with the code. With any of the CodeLens indicators you can access the details in a couple of ways.



    Mouse Access

    You can click on any indicator to see the results:

    5-16-2012 6-56-14 PM


    Also there is a scroll bar (if needed) to allow moving through multiple entries:

    5-16-2012 6-57-02 PM



    Keyboard Access

    If you don’t want to take your hands off the keyboard, you can simply hold down your ALT key on your keyboard and each indicator will show a number above it:

    5-16-2012 7-02-04 PM


    Pressing ALT + [indicator number] will show the information within. In this example, ALT+2 will open the references. These numbers are static so you can always depend on them. Regardless of where you are, ALT+2 will always show the references.




    Show Tested By

    With any method we often want to know what tests are associated with it. The Show Tested By option will show what tests are associated with your code and an overall status indicator:

    5-16-2012 7-35-20 PM


    As you can see in this example, the tests haven’t been run yet as shown by the icon to the left of the test summary. If I click on the Show Tested By section or press ALT+3:

    5-16-2012 7-42-07 PM


    Then I get the information window:

    5-16-2012 7-49-55 PM


    Notice we can run the currently selected test or run all tests. To access the Run All or Run links with just your keyboard just use your TAB key. If you want to examine an individual test method you can press Enter (or Double Click) any entry in the information window and the editor will show the test method details:

    5-16-2012 8-02-04 PM


    Let’s jump back to our original code. Looking at the Show Tested By indicator we can see that if all the tests have passed this is the result:

    5-16-2012 8-06-05 PM


    If any tests fail, then we will see something like this:

    5-16-2012 8-10-03 PM


    You can see any tests that failed by opening the Show Tested By area:

    5-16-2012 8-11-33 PM




    Show Test Status

    Now let’s discuss the Show Test Status indicator. Normally, when we look at a test method this is what we see:

    5-16-2012 8-22-36 PM


    However, once we run our tests, it would be nice to see the status of the run with the test method itself. This is where Show Test Status comes in. By turning this on we can see the status of the last run represented as an icon (to the left of the references information):

    5-16-2012 8-27-31 PM


    If you want to see the latest test result, you can Click the icon or press ALT+1:

    5-16-2012 8-29-33 PM


    And see the test result window:

    5-16-2012 8-34-24 PM




    Show Authors and Show Changes

    The Show Authors and Show Changes options actually show the same information but filter it in two ways. Both are updated when you Get Latest from source control. Show Authors will show the name of the last person to make a change plus a count of any other unique individuals who have worked with the same code:

    5-16-2012 9-04-43 PM


    Whereas Show Changes will show the total number of changes in the code’s history:

    5-16-2012 9-14-16 PM


    Selecting either of these by using your mouse or by pressing ALT+4 and ALT+5 respectively:

    5-16-2012 9-17-18 PM


    Opening either one of these indicators will reveal the following:

    5-16-2012 9-19-59 PM


    This is where things get interesting. You can Right Click any entry in this window to be presented with three options that we will examine in detail:

    5-16-2012 9-24-40 PM



    View Diff Of Changeset[Number]

    This will show the difference between the selected changeset and the one prior for comparison:

    5-16-2012 9-29-10 PM



    Changeset Details

    This choice will show the details of the changeset in Team Explorer:

    5-16-2012 9-30-39 PM



    Send Email To [Author]

    Pretty self-explanatory, this option will open up your default email program and allow you to begin crafting an email to the author of the changeset with a link to remind the author of the code changed:

    5-16-2012 9-34-22 PM 





    In this section I’ll show some additional items that may be of interest to you as you discover more about CodeLens.


    Navigating Between Information Windows

    Once you have opened any information window:

    5-16-2012 12-04-12 PM


    You can use RIGHT ARROW or LEFT ARROW to move between the other information windows.

    (NOTE: The team that works on this let me know that the official keyboard shortcut for moving between these windows is ALT+RIGHT ARROW and ALT+LEFT ARROW. Be aware that just plain ARROW keys may stop working in future iterations of the build and you will need to use the official keys to move between windows here.)



    Skipping Lines

    I began this article saying that this feature is well thought out. Nothing emphasizes my point more than the way the indicator are treated in the editor. Rather than being intrusive and even throwing off your line counts by treating the indicators as a line of code the indicators are simply decorations added in the editor and are not counted as an actual line:

    5-16-2012 10-14-49 PM


    The concept of being non-intrusive is so ingrained into this feature that even the cursor will skip over it when you are using your keyboard to move between lines in the editor.



    Changing Indicator Fonts and Colors

    If you want to modify the font and/or color of the indicators you can go to Tools | Options | Environment | Fonts and Colors then select Show Settings For the Code Information Indicators:

    5-16-2012 9-54-27 PM


    Experiment with these to find settings that are appealing to you.



    Turning It Off

    If, for some reason, you don’t like this feature then you can always turn it off by going to Tools | Options | Text Editor | All Languages | Code Information Indicators and disable the feature.





    CodeLens is truly an epic addition to the Visual Studio world. I am a huge fan of this feature. Try it yourself and tell me what you think! :)

  • The Ultimate Visual Studio Tips and Tricks Blog

    Code Metrics – Maintainability Index


    SKU: Premium, Ultimate

    Versions: 2008, 2010

    Code: vstipTool0134


    At long last it is time to look at the final metric from the code metrics (see vstipTool0129, “Code Metrics - Calculating Metrics”): maintainability index. As with the other metrics it is best to start with some definitions. First, from the MSDN main documentation:

    “[Maintainability Index c]alculates an index value between 0 and 100 that represents the relative ease of maintaining the code. A high value means better maintainability. Color coded ratings can be used to quickly identify trouble spots in your code. A green rating is between 20 and 100 and indicates that the code has good maintainability. A yellow rating is between 10 and 19 and indicates that the code is moderately maintainable. A red rating is a rating between 0 and 9 and indicates low maintainability.”

    (emphasis added)


    Unlike other metrics, there is virtually no ambiguity to reading this value. David Kean on the code analysis team blog provides a view into the values, icons, and colors you could see:




    Using this information you can easily see areas of code that may need attention. But what does this look like when you actually use it? I took some sample code and created extreme conditions to show how this looks in actual use. If we just look at maintainability index everything looks fine:



    Be careful! This is not the whole picture. Maintainability index is actually a calculation using three metrics. Two of the metrics used are lines of code (see vstipTool0130, “Code Metrics - Lines of Code”) and cyclomatic complexity (see vstipTool0131, “Code Metrics - Cyclomatic Complexity”). Without looking at these you will miss something. Let’s add them to our code metrics:



    We have a problem. The lines of code don’t’ really seem excessive but the cyclomatic complexity is very, very high and that is a red flag. We need to dig into the hierarchy to see what is going on. I’ll go two levels down:



    Now we see a major problem. Just looking at the maintainability index alone wouldn’t have revealed the issue at a high level but paying attention to the cyclomatic complexity definitely revealed a code smell ( that needed further investigation. At this point we would take action to correct for high cyclomatic complexity.

    The moral of this story is to pay attention to your metrics. At this point you should be well armed to use maintainability index for your code. If you want to get into the details then read on…



    Digging Deeper

    When dealing with metrics the details can be important. It’s good to see how they are calculated. Fortunately, the Code Analysis Team blog has provided the calculation used for maintainability index:

    Maintainability Index = MAX(0,(171 - 5.2 * log(Halstead Volume) - 0.23 * (Cyclomatic Complexity) - 16.2 * log(Lines of Code))*100 / 171)


    This is just one of many ways to calculate maintainability index ( and there are calculation variants that take into account additional items such as comments. I’ve already covered lines of code (see vstipTool0130, “Code Metrics - Lines of Code”) and cyclomatic complexity (see vstipTool0131, “Code Metrics - Cyclomatic Complexity”). Halstead Volume, on the other hand, is new to our discussions.


    The Halstead metrics where created in 1977 by Maurice Halstead to create empirical methods to measure software development efforts. He sought to identify and measure software properties as well as show relationships between them. ( You can find a great description of how to calculate Halstead metrics at


    Halstead Volume can be defined as “[…] the size of the implementation of an algorithm. The computation […] is based on the number of operations performed and operands handled in the algorithm. Therefore [it] is less sensitive to code layout than the lines-of-code measures.”



    Code Analysis

    When using code analysis, the Extended Design Guideline rule set contains a maintainability area:



    Inside the maintainability area is a rule for maintainability index:



    This rule is triggered when the maintainability index is low. You can learn more about the rule here:

    Unfortunately, the documentation doesn’t talk about the thresholds set for this rule but I ran my own experiments and found that at 19 or below this rule will issue a warning by default.

  • The Ultimate Visual Studio Tips and Tricks Blog

    Cut or Delete the Current Line


    Keyboard:  CTRL + L (cut text); SHIFT + DEL(cut text and carriage return); CTRL + X(cut text and carriage return); CTRL + SHIFT + L (delete)
    Command:  Edit.LineCut; Edit.Cut; Edit.Cut; Edit.LineDelete
    Versions:  2008,2010
    Published:  4/4/2010
    Code:  vstipEdit0038


    You can quickly and easily do a cut operation by doing the following:

    1. Place your cursor on any line:
    2. Do one of the following commands:
      1. CTRL + L to cut the text only
      2. SHIFT + DEL or CTRL + X to cut the line and the carriage return at the end of the line

    If you want to DELETE the line instead you can use CTRL + SHIFT + L

  • The Ultimate Visual Studio Tips and Tricks Blog

    Visual Studio 2013: Format the Current Document or Selection



    NOTE: This is an older feature. I’ve updated the information for VS2013.



    Format Document

    This one is a little known feature you can take advantage of when working with your code. Assuming you have some unformatted code:

    5-16-2012 12-14-43 PM


    5-16-2012 12-10-39 PM



    You can format the entire document by going to Edit -> Advanced -> Format Document (CTRL+K, CTRL+D) to get this:

    5-16-2012 12-16-13 PM


    5-16-2012 12-18-01 PM




    Format Selection

    You can also do this with just a selection of code:

    5-16-2012 12-21-01 PM


    Go to Edit -> Advanced -> Format Selection (CTRL+K, CTRL+F) to get this:

    5-16-2012 12-23-33 PM




    Formatting Options

    I won’t go deep into it here but it’s important to remember that the automated formatting follows the default rules you can easily change by going to Tools | Options | Text Editor | [Language] | Formatting in most cases. For example, to change the HTML rules go to Tools | Options | Text Editor | HTML | Formatting:

    5-16-2012 12-27-47 PM


    In the case of HTML, you can go pretty deep into the formatting options by clicking on the Tag Specific Options button:

    5-16-2012 12-29-32 PM





    Formatting the document or selection is a great way to make your code more readable. Enjoy!

  • The Ultimate Visual Studio Tips and Tricks Blog

    Visual Studio 2012 New Features: Improving User Stories and Requirements with PowerPoint Storyboarding


    For Visual Studio Premium and Ultimate users there is a great new add-in for PowerPoint that can really help you called the PowerPoint Storyboarding add-in.  Using this feature you can quickly draft an interface design and get stakeholder feedback.  Plus, since it’s PowerPoint, even stakeholders can change elements easily to show you what they really want.  Let me show you how this works.


    Getting Started

    To get started just go to the Microsoft Visual Studio 2012 program folder and select PowerPoint Storyboarding:

    PowerPoint Storyboarding


    This will open up PowerPoint, give you a blank slide, and take you to the Storyboarding tab:



    It will also show the storyboard shapes to the right which are searchable via the search box (CTRL + G):



    (NOTE:  You can download more shapes by going to


    From here you typically start with a background from the storyboard shapes:



    For this example, I am developing a SharePoint solution so want a SharePoint background:



    I can edit existing elements and/or add new storyboard shapes:



    I can right-click on any item and add hyperlinks that the user can click on to take them to another “screen” (slide) for more interaction:



    If you find yourself using a customized set of shapes frequently just select the shapes and add them to your storyboard shapes:




    One of the coolest features is the ability to quickly update your custom shapes while you are working on them as well as export them for other team members to use:



    As you gain experience with the tool, here is an example of what you can accomplish:



    If you are using Team Foundation Server (you ARE using TFS aren’t you?) then you can also link your storyboard to one or more requirements/user stories with the Storyboard Links button:



    The only caveat is you have to store the ppt file in a location that is accessible to others or it will give you this message:



    I prefer to use the project portal created by TFS to store my storyboards personally.  Once you have saved the file to a shared location then you can link it to work items.  When you first open the Linked Work Items dialog it will show the collection you are connected to in the title bar:



    You can click Link To to link items in the current collection and/or Connect to go to another collection and then run queries for the items you are interested in selecting:



    From now on you can see the work items that are associated with with the storyboard and be able to trace the work you are doing back to some requirement/user story/task/etc…


    There you have it!  Give the new storyboarding features a try yourself.  If you want to see the docs on this feature, I would check out these two links:

    Normally our documentation is *cough* less than optimal but the two items above are actually pretty good.

Page 2 of 135 (1,345 items) 12345»