Blog - Title

Visual Studio 2013 Current Status

  • The Ultimate Visual Studio Tips and Tricks Blog

    Searching Your Favorites in Vista


    Okay so I figured out how to put the .url extension in the advanced indexing options so you can search your favorites only to find out that, hey, you don't have to do all that crap.  If you want to search your favs in IE you just type in a part of the name and it shows up.  Talk about a DUH moment.  So if you haven't played with it much, I suggest you try out the seriously cool search features in Vista.  As for me, I'm off to the Windows Help site to brush up on my searching...

    Searching Favorites in Vista

  • The Ultimate Visual Studio Tips and Tricks Blog

    Comment and Uncomment Code


    Keyboard:  CTRL + K, CTRL + C (comment); CTRL + K, CTRL + U (uncomment)
    Menu:  Edit -> Advanced -> Comment Selection; Edit -> Advanced -> Uncomment Selection
    Command:  Edit.CommentSelection; Edit.UncommentSelection
    Versions:  2008,2010
    Published:  4/13/2010
    Code:  vstipEdit0047


    Download the seriously cool Tip of the Day Extension to get the daily tips delivered to your Start Page!


    Sometimes it's the simple stuff we forget about.  So I present to you the classic Comment and Uncomment Selection.  Naturally, you have the Comment and Uncomment buttons:



    And, of course, we have the Menu items:



    But it's the keyboard shortcuts that really rock!  These will, predictably, comment or uncomment lines of code for you.  So, let's say you have some code you want commented out.  Just select it:



    Then press CTRL + K, CTRL + C (in this example):



    Voila!  It's commented out.  Okay, great, but what if you don't want to use the mouse?  No problem!  Just hold ALT + SHIFT + [UP or DOWN ARROW] to do a vertical selection (NOTE:  In VS2008 you have to go right or left one character before you can go up or down for vertical selection):



    Then press CTRL + K, CTRL + U (in this example):



    And there you go!  Comment and Uncomment actions anytime you want!

  • The Ultimate Visual Studio Tips and Tricks Blog

    Turn on Line Numbers


    Menu:  Tools -> Options -> Text Editor -> All Languages -> General -> Display
    Versions:  2008,2010
    Published:  3/7/2010
    Code:  vstipEdit0025


    Line numbers are not on by default.  To turn on line numbers just go to Tools -> Options -> Text Editor -> All Languages -> General -> Display and check Line numbers:


  • The Ultimate Visual Studio Tips and Tricks Blog

    Calling a PowerShell Script From Your .NET Code



    Well, Mike F. reminded me to write this article on 5/29 and I am FINALLY getting around to doing it.  Also wanted to give a shout out to Max T. who provided some inspiration on this one as well.  For the code, I borrow very heavily from the article written by Jean-Paul Mikkers found at:


    NOTE:  There is an async version of his code that he does as a follow up.  I don't use it because I want to remove extra code noise to focus on the act of calling the script itself.  If you want to take a stab at the async version (and there are LOTS of good reasons to do so) then you can go here: 


    So, on to the goodness!


    First, you need to make sure you have Visual Studio (any version) installed and have PowerShell installed.  You can get PowerShell from here:






    1.   Now, let's crank out a simple PoweShell script that we are interested in calling.  We will call a simple script that takes a couple of numbers and returns the sum of those numbers.  This may seem overly simplistic but it is an easy way to demonstrate a complete round-trip between our app and the script without getting bogged down in extra BS that comes with a fancier script.  I'll call the script AddItUp.ps1 and it is included in the source code download, just put it anywhere you can get to easily.  Feel free to dig into the guts of it later on but for now just assume it does what we need it to do. 


    Here is the code for the script if you just want to make your own real quick:


    # begin

    function AddStuff($x,$y)
       $x + $y


    AddStuff 6 5

    # end


    NOTE:  Some inspiration and just a cool site for scripts came from just as an fyi




    2.  Test the script by opening PowerShell and navigating to the directory where it is and typing what you see in the graphic, you should get the expected result.






    3.  Okay!  We have a script that works but now what?  Well we have to call that puppy from our code so let's create a project and get ready to make our magic happen.  Crank out a new Windows App for us to use.  Call the Project CallMeCS or CallMeVB depending on your language.








    4.  For the interface, just gimme a button and a label.  Resize the form a bit so we don't have wasted space.  Real simple stuff...






    5.  Double-click on the button to go into our code.










    6.  Now we need to add an assembly that is one of a set we got with our install of PowerShell.  You can find these assemblies at C:\Program Files\Reference Assemblies\Microsoft\WindowsPowerShell\v1.0




    7.  Right-click on your project and choose Add Reference...





    8.  Select the Browse Tab and locate these assemblies then add a reference to the System.Management.Automation.dll

    NOTE:  If you want to dig deeper into the contents of this namespace, you can check it out here:





    9.  Now that we have our reference we need to add some using/imports statements to make getting to the classes we want to use easier.  Make sure to put these at the top of your code page outside any other code. 



    using System.Collections.ObjectModel;
    using System.Management.Automation;
    using System.Management.Automation.Runspaces;
    using System.IO;



    Imports System.Collections.ObjectModel
    Imports System.Management.Automation
    Imports System.Management.Automation.Runspaces
    Imports System.Text
    Imports System.IO



    10.  Okay, this next part is a little funkier.  While I liked the code that Mikkers had, I wanted to be able to load up a file from my file system and use it instead of just putting code into a textbox.  That created some VERY interesting new challenges but the end result worked out well.  So, to that end, we will create two helper methods:  RunScript and LoadScript.  RunScript is the code essentially unchanged from Mikkers' article and LoadScript is my helper function that will load the contents of a script file and return a string.



    11.  Let's begin with the RunScript method.  We will add this method to the Form1 class to make our life easier. 



    private string RunScript(string scriptText)
           // create Powershell runspace
           Runspace runspace = RunspaceFactory.CreateRunspace();

           // open it

           // create a pipeline and feed it the script text
           Pipeline pipeline = runspace.CreatePipeline();

           // add an extra command to transform the script output objects into nicely formatted strings
           // remove this line to get the actual objects that the script returns. For example, the script
           // "Get-Process" returns a collection of System.Diagnostics.Process instances.

           // execute the script
           Collection<PSObject> results = pipeline.Invoke();

           // close the runspace

           // convert the script result into a single string
           StringBuilder stringBuilder = new StringBuilder();
           foreach (PSObject obj in results)

           // return the results of the script that has
           // now been converted to text
           return stringBuilder.ToString();



    ' Takes script text as input and runs it, then converts
        ' the results to a string to return to the user
        Private Function RunScript(ByVal scriptText As String) As String

            ' create Powershell runspace
            Dim MyRunSpace As Runspace = RunspaceFactory.CreateRunspace()

            ' open it

            ' create a pipeline and feed it the script text
            Dim MyPipeline As Pipeline = MyRunSpace.CreatePipeline()


            ' add an extra command to transform the script output objects into nicely formatted strings
            ' remove this line to get the actual objects that the script returns. For example, the script
            ' "Get-Process" returns a collection of System.Diagnostics.Process instances.

            ' execute the script
            Dim results As Collection(Of PSObject) = MyPipeline.Invoke()

            ' close the runspace

            ' convert the script result into a single string
            Dim MyStringBuilder As New StringBuilder()

            For Each obj As PSObject In results

            ' return the results of the script that has
            ' now been converted to text
            Return MyStringBuilder.ToString()

        End Function



    12.  Now we want to add in our LoadScript method to make getting the script into a variable easier.



    // helper method that takes your script path, loads up the script
            // into a variable, and passes the variable to the RunScript method
            // that will then execute the contents
            private string LoadScript(string filename)
                    // Create an instance of StreamReader to read from our file.
                    // The using statement also closes the StreamReader.
                    using (StreamReader sr = new StreamReader(filename))

                        // use a string builder to get all our lines from the file
                        StringBuilder fileContents = new StringBuilder();

                        // string to hold the current line
                        string curLine;

                        // loop through our file and read each line into our
                        // stringbuilder as we go along
                        while ((curLine = sr.ReadLine()) != null)
                            // read each line and MAKE SURE YOU ADD BACK THE
                            // LINEFEED THAT IT THE ReadLine() METHOD STRIPS OFF
                            fileContents.Append(curLine + "\n");

                        // call RunScript and pass in our file contents
                        // converted to a string
                        return fileContents.ToString();
                catch (Exception e)
                    // Let the user know what went wrong.
                    string errorText = "The file could not be read:";
                    errorText += e.Message + "\n";
                    return errorText;




    ' helper method that takes your script path, loads up the script
        ' into a variable, and passes the variable to the RunScript method
        ' that will then execute the contents
        Private Function LoadScript(ByVal filename As String) As String


                ' Create an instance of StreamReader to read from our file.
                ' The using statement also closes the StreamReader.
                Dim sr As New StreamReader(filename)

                ' use a string builder to get all our lines from the file
                Dim fileContents As New StringBuilder()

                ' string to hold the current line
                Dim curLine As String = ""

                ' loop through our file and read each line into our
                ' stringbuilder as we go along
                    ' read each line and MAKE SURE YOU ADD BACK THE
                    ' LINEFEED THAT IT THE ReadLine() METHOD STRIPS OFF
                    curLine = sr.ReadLine()
                    fileContents.Append(curLine + vbCrLf)
                Loop Until curLine Is Nothing

                ' close our reader now that we are done

                ' call RunScript and pass in our file contents
                ' converted to a string
                Return fileContents.ToString()

            Catch e As Exception
                ' Let the user know what went wrong.
                Dim errorText As String = "The file could not be read:"
                errorText += e.Message + "\n"
                Return errorText
            End Try

        End Function


    13.  Finally, we just need to add some code for our button's click event.



    private void button1_Click(object sender, EventArgs e)
                // run our script and put the result into our textbox
                // NOTE: make sure to change the path to the correct location of your script
                textBox1.Text = RunScript(LoadScript(@"c:\users\zainnab\AddItUp.ps1"));



    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
            'run our script and put the result into our textbox
            'NOTE: make sure to change the path to the correct location of your script
            TextBox1.Text = RunScript(LoadScript("c:\users\zainnab\AddItUp.ps1"))
    End Sub


    14.  That's it!!  You should be able to run your code and you should get this:




    Don't sweat it if you think this is a lot to type.  I have included the source code for you to use.  Enjoy!

  • The Ultimate Visual Studio Tips and Tricks Blog

    Visual Studio 2012 Color Theme Choices



    The other day I had a customer complain about not liking the Light and Dark color themes that come out of the box with VS2012.  I’m always up for more choices with color schemes so thought I would make sure you all knew about the options for color schemes.  There are actually many, many ways you “could” change your fonts and colors but I’ll show you what I consider to be the top two methods in no particular order.


    Visual Studio Color Theme Editor



    One of the more popular extensions we created after VS2012 launched was the Color Theme Editor.  it comes with pre-set themes as well as the ability to customize your themes any way you see fit.  Since it is an extension, you can obtain this feature quickly by following the link to the extension and then clicking the Download link:



    Next just click the Open button to install the extension:



    Now just follow the on-screen instructions to finish the installation.



    Using the Theme Editor

    To use the editor you can simply choose a theme by going to Tools | Change Color Theme and selecting a pre-set theme:



    Notice that just below Change Color Theme is Customize Colors which allows you to create custom color sets as well.  It’s not very intuitive so let me walk you though a little bit of it.  First you have to pick an existing theme to copy from and then give the custom theme a name and click the Create button:



    Now you will be presented with a dizzying array of options you can modify to create a custom look and feel to your environment:




    DANGER:  It appears that the Color Theme Editor doesn’t like it when you import settings through the IDE and will use the imported settings instead of the expected settings when changing themes.  My advice is to create a custom theme and set it as the current theme then import settings as desired (shown below) so you don’t get messed up themes.





    If you haven’t been to yet then you have missed out on some seriously cool styles:





    Getting a Style

    Let me walk you though how to use one of these styles.  First, you need to find a style you like.  I suggest you pick from the All-Time Favourites section.  My personal favorite for quite some time has been WekeRoad Ink:




    Once you select the style you want then select the proper version of Visual Studio and click the download button:



    This will give you a .VSSETTINGS file with just font and color information that you can import into the IDE by going to Tools | Import and Export Settings:




    Choose Import Selected Environment Settings then click the Next button:




    You should absolutely make sure you BACK UP YOUR CURRENT SETTINGS then click Next:




    Use the Browse button to find the .VSSETTINGS file you found then click Next:




    Click the Finish button on the current screen:




    Choose Close on the last screen and you should have your new color theme:




    Undoing Any Changes

    You can import your previous settings to change the theme back to any colors you had before.  For more information see my previous post here:

  • The Ultimate Visual Studio Tips and Tricks Blog

    Visual Studio 2013: TODO Comments and Custom Tokens in the Task List


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


    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 or custom tokens?  They seriously rock if you have never used them and, because they go in source code, everyone can have access to the information when you check-in the code!



    TODO Comments

    So here's how TODO comments work: 



    In VB you just put any comment in that begins with the letters "todo" (case doesn't matter):

    5-16-2012 12-13-33 PM



    C# and C++

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

    5-16-2012 12-17-39 PM



    In C++ you have to explicitly turn this feature on.  Go to Tools | Options | Text Editor | C/C++ | View and change Enumerate Comment Tasks to True:

    5-16-2012 12-19-14 PM



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

    5-16-2012 12-22-52 PM

    Note: You can Double Click any entry to automatically have the editor go to the respective line in your source.



    If you don’t see the entries, make sure you have set the task list to see comments:

    5-16-2012 12-24-46 PM




    Custom Tokens

    We actually have several tokens you can use in addition to TODO. To see all the existing tokens go to Tools | Options | Environment | Task List:

    5-16-2012 12-28-08 PM




    You are welcome to use HACK and UNDONE as well. The MSDN documentation is horrifically bad when it comes to describing these tokens and I don’t agree with the description of use necessarily. Here is what it says:

    “Items labeled TODO, HACK, and UNDONE in the Task List window indicate code problems that do not keep the project from compiling, but that do cause run-time errors. You should correct these errors before running the project.”


    Also, be aware that the number of entries that appear in the Task List changes depending on the type of project you are working on. With VB and C# projects, the Task List displays all of the comments in the project whether the file is open or not. With C++ projects, the Task List displays only the comments that are found in the files currently opened for edit.



    Creating Custom Tokens

    Feel free to create your own tokens for your use. Creating your own tokens is very simple, just pick a name for your token and type it in the Name textbox:

    5-16-2012 1-07-32 PM

    Note: UnresolvedMergeConflict looks like an error but isn’t it is an actual token that will make a high priority item in the Task List.



    Next choose a priority level:

    5-16-2012 1-09-02 PM



    Then click the Add button to make it an active token:

    5-16-2012 1-10-32 PM



    You will see it in your list:

    5-16-2012 1-11-42 PM



    Now you can use the token in your comments:

    5-16-2012 1-14-01 PM



    Sharing Custom Tokens

    Be aware that any tokens you create ARE NOT SHARED with other developers so you may want to come up with a standard set of tokens for everyone to use if you intend to leverage this feature company-wide then export them ( and have folks import them (





    Tokens are a pretty nice feature to keep track of places in your code you need to revisit. I don’t suggest them over, say, tasks in Team Foundation Server but they are a great short-term reminder for things that need to get attention. If you decide you would like to create Task List items programmatically you can do that as well. Here is a link to some guidance to get you started:

  • The Ultimate Visual Studio Tips and Tricks Blog

    Visual Studio Update 1 Is Available!


    The first update for VS2013 came out yesterday and is heavy on bug fixes but not much in the way of new functionality. You can download the latest update from here:



    Here is a list with the new additions underlined:



    Note Unless otherwise indicated, linked items will take you to Microsoft Connect webpages.

    Team Foundation Server

      • You cannot change the process parameters in the Queue Build dialog box in Visual Studio 2013.



    • Fixes screen reader compatibility for the "Debug Managed Memory" feature.
    • Updates the "Debug Managed Memory" feature to work on computers that have Windows Internet Explorer 9 installed.
    • MMA UI can be read by screen reader now.


    Directed Graph Markup Language

    • Non-ENU Visual Studio crashes when the Legend in a DGML document is updated by disabling or deleting any item in the legend list.

    Graphics Debugger

    • Graphics assets that are referenced by a graphics mesh are not deployed correctly.
    • When you capture a frame on a Windows 7 computer that does not have KB2670838 installed, you may receive the following error message:

      The Graphics Diagnostics engine couldn't create a debug device, most likely because the matching Windows SDK for this version of Windows is not installed. Please install the matching SDK and try again.

    Web Tools

    Visual C++

    • Assume that you edit a dialog that contains at least one picture control in Resource Editor. After you save the file, the project can no longer be compiled.
    • When you edit multiple resources in Resource Editor, Visual Studio crashes randomly.
    • Addresses some Visual C++ automatic formatting issues.
    • Visual C++ IDE does not work as expected if there is an unexpected registry subkey under the following registry key:
    • When you try to link with PGO on amd64_x86 complier, Visual Studio crashes.



    • IntelliTrace Viewer is updated to support Internet Explorer 9.


    Cloud Platform

    • "Object reference not set to an instance of an object" error message when an external user tries to save any intrinsic entity data from an Office 365-based cloud business application.


    Visual Studio Test

      Load Test
      • Visual Studio freezes when you try to run a load test in the cloud by using Visual Studio Online for the first time when there is no active connection to a Visual Studio Online account from your Team Explorer.
      • You cannot run load tests beyond 250 virtual users if you activated Visual Studio Ultimate by using an MSDN subscription.
      • When you activate Visual Studio by signing in to your Visual Studio online account by using your MSDN subscription id, you cannot run remote load tests, load tests together with a loadtest plugin or a virtual user load more than 250.
      • Load testing in Cloud with Visual Studio Online is broken on a computer that has Internet Explorer 9 installed. The Load Test Manager and Load Test Results windows do not render with Internet Explorer 9 correctly.
      • When there are multiple Visual Studio Online Accounts connected to in Visual Studio and none of them are active, one of the accounts is picked to communicate with the Load Testing in Cloud with Visual Studio Online, which results in a broken experience.
      • After you run a cloud-based load test by using Visual Studio Online, the "Download Result" operation fails for the first time. Additionally, you receive the following error message:

        There was an error while importing the result file. Details: The system cannot find the file specified. After correcting the problem open the results from Load Test Manager.

    XAML Tools

    • Improved the stability of the XAML designers in Visual Studio and Blend in a variety of scenarios for all XAML platforms (such as Windows Store, Windows Phone, Silverlight, WPF).
    • Addressed an issue concerning the packaging of Windows Store applications in which both XBF and XAML were packaged into a Windows Store AppX package when referencing Extension SDKs.

    XAML Designer

    • Allow controls compiled for Windows 8 to display in the Toolbox for Windows 8.1 projects.

    Release Management for Visual Studio 2013


  • The Ultimate Visual Studio Tips and Tricks Blog

    Turn Off the Uppercase Menu in Visual Studio 2012


    I’ve been seeing a ton of posts lately on this feature so thought I would share here as well.  I also like to give credit where credit is due so I did a search and it looks like the earliest mention of this ability is by Richard Banks in his post 6\1\2012 here:  If anyone knows of an earlier one done by someone else let me know but this looks like the first mention of it.  If I were a betting man I would say he most likely used Process Explorer to make this discovery which is my favorite tool for finding things like this.



    Mixed Case is Your Friend

    Okay so you really, really don’t like the Uppercase menu in VS2012 because you feel like it is shouting at you:




    You would rather go back to mixed case for your menu:





    Not a problem! Let’s see how:

    WARNING:  Making changes to the registry can cause unexpected results so do any changes at your own risk!


    Manual Registry Change

    Open the registry editor and go to HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\11.0\General\
    (For Windows 8 Desktop Express go to HKCU\Software\Microsoft\WDExpress\11.0\General) //special thanks to msm8bball for the update
    (For Web Express go to HKEY_CURRENT_USER\Software\Microsoft\VSWDExpress\11.0\General)

    1. Create a new DWORD value called SuppressUppercaseConversion set to 1
    2. Restart Visual Studio and you should see the change

    NOTE: Watch your spelling if you are typing this manually.



    PowerShell Goodness

    If you like to “simplify” this a bit you can use PowerShell to run a nice script to make this happen.  However, if you haven’t used PowerShell before this may not be faster for you.

    1. Go to the Start button and type powershell and select the Windows PowerShell Entry:
    2. In the PowerShell window copy the script below and paste it in then press Enter:
      Set-ItemProperty -Path HKCU:\Software\Microsoft\VisualStudio\11.0\General -Name SuppressUppercaseConversion -Type DWord -Value 1

    3. Restart Visual Studio and enjoy!
  • The Ultimate Visual Studio Tips and Tricks Blog

    Code Metrics – Cyclomatic Complexity


    SKU: Premium, Ultimate

    Versions: 2008, 2010

    Code: vstipTool0131


    When working with code metrics, one of the least understood items seems to be cyclomatic complexity. Essentially, with cyclomatic complexity, higher numbers are “bad” and lower numbers are “good”. We use cyclomatic complexity to get a sense of how hard any given code may be to test, maintain, or troubleshoot as well as an indication of how likely the code will be to produce errors. At a high level, we determine the value of cyclomatic complexity by counting the number of decisions made in our source code. In this tip we will start out with a simple example of cyclomatic complexity to understand the concept quickly then give some additional information on actual usage and suggested limits. Finally, I’ve added a section of citations that can be used to dig deeper into this subject.


    Cyclomatic Complexity: A Simple Example

    Cyclomatic complexity is defined as measuring “the amount of decision logic in a source code function” [NIST235]. Simply put the more decisions that have to be made in code, the more complex it is.

    Let’s see it in action. Create a new console application and immediately calculate your code metrics by going to Analyze | Calculate Code Metrics for Solution:



    Notice the cyclomatic complexity is at 2 (the lowest value possible). If I add non-decision code, notice the complexity doesn’t change:




    If I add a decision, the cyclomatic complexity value goes up by 1:



    When I change the if statement to a switch statement with 4 decisions to be made then it goes from the original 2 to 6:



    Let’s take a look at a larger code base. Here are the metrics from the Tailspin Toys sample code (



    Notice that most of the items, as we drill down into the Products_Related class, have a value of 1 but a couple of them have a complexity of 5. By itself this may not be a big deal, but given that most other members have a 1 in the same class I would definitely look closer at those two items and see what is in them. You can do this by right-clicking the item and choosing Go To Source Code from the context menu. Let’s take a closer look at Product.set(Product):



    Given all the if statements, we can see why the cyclomatic complexity is at a 5. At this point we may decide that this is an acceptable level of complexity or we might refactor to reduce the complexity.



    The Magic Number

    As with many metrics in our industry, there is no exact cyclomatic complexity limit that fits all organizations. However, [NIST235] does indicate that a limit of 10 is a good starting point:

    “The precise number to use as a limit, however, remains somewhat controversial. The original limit of 10 as proposed by McCabe has significant supporting evidence, but limits as high as 15 have been used successfully as well. Limits over 10 should be reserved for projects that have several operational advantages over typical projects, for example experienced staff, formal design, a modern programming language, structured programming, code walkthroughs, and a comprehensive test plan. In other words, an organization can pick a complexity limit greater than 10, but only if it is sure it knows what it is doing and is willing to devote the additional testing effort required by more complex modules.” [NIST235]



    Cyclomatic Complexity and Line Numbers

    As I mentioned in vstipTool130 (“Code Metrics – Lines of Code”), just looking at the number of lines of code by itself is, at best, a very broad predictor of code quality. There is some basic truth to the idea that the more lines of code in a function, the more likely it is to have errors. However, when we combine cyclomatic complexity with lines of code then we have a much clearer picture of the potential for errors.

    As described by the Software Assurance Technology Center (SATC) at NASA:

    “The SATC has found the most effective evaluation is a combination of size and [Cyclomatic] complexity. The modules with both a high complexity and a large size tend to have the lowest reliability. Modules with low size and high complexity are also a reliability risk because they tend to be very terse code, which is difficult to change or modify.” [SATC]



    Code Analysis

    When using code analysis, the Design Guideline rule sets contain maintainability areas:



    Inside the maintainability area is a rule for complexity:



    This rule issues a warning when the cyclomatic complexity reaches 25 so it is a good thing to have to keep you from having excessive complexity. You can learn more about the rule here:



    Special Note on Visual Studio 2010

    There may be differences when calculating code metrics using Visual Studio 2010 that don’t apply to Visual Studio 2008. The online documentation ( gives the following reasons:

    • The function contains one or more catch blocks. In previous versions of Visual Studio, catch blocks were not included in the calculation. In Visual Studio 2010, the complexity of each catch block is added to the complexity of the function.
    • The function contains a switch (Select Case in VB) statement. Compiler differences between Visual Studio 2010 and earlier versions can generate different MSIL code for some switch statements that contain fall-through cases.



    Putting It All Together

    The bottom line is that a high complexity number means greater probability of errors with increased time to maintain and troubleshoot. Take a closer look at any functions that have a high complexity and decide if they should be refactored to make them less complex.





    McCabe, T. and A. Watson (1994), Software Complexity (CrossTalk: The Journal of Defense Software Engineering).



    Watson, A. H., & McCabe, T. J. (1996). Structured Testing: A Testing Methodology Using the Cyclomatic Complexity Metric (NIST Special Publication 500-235). Retrieved May 14, 2011, from McCabe Software web site:



    Rosenberg, L., Hammer, T., Shaw, J. (1998). Software Metrics and Reliability (Proceedings of IEEE International Symposium on Software Reliability Engineering). Retrieved May 14, 2011, from Penn State University web site:

  • The Ultimate Visual Studio Tips and Tricks Blog

    Change Your Visual Studio Color Scheme


    Menu:  Tools -> Import and Export Settings
    Command:  Tools.ImportandExportSettings
    Versions:  2008,2010
    Published:  8/13/2010
    Code:  vstipEnv0034


    Folks I want to get your input on the possible title for the new book.  Give me your comments at


    Ever see a cool set of colors your friend or co-worker has and wish you could get it too?  Ever go to and want some of those cool color schemes?




    Well you can get the colors you want!  Let's walk through how it's done:


    Seeing What You Like

    First, you see a seriously cool color scheme on someone's screen or at the Studio Styles site:





    Getting the Goods


    On Someone's Computer

    Now that you see what you like, get them to export their Fonts and Colors.  Go to Tools -> Import and Export Settings:




    Click Next and ONLY export the Fonts and Colors NOTHING ELSE:




    Click Next then give the settings a cool name and click Finish:




    On the Studio Styles Site

    Find the style you want and click on it:



    Pick your Visual Studio version



    Click on "Download this scheme" then follow the instructions in the next section.



    Changing Your Colors

    Put the settings file on a USB key or somewhere you can get to it from your computer.  While you can put the file anywhere you want on your system, I prefer to put it with the other settings files located at "C:\Users\<user>\Documents\Visual Studio <version>\Settings":




    Now just go to Tools -> Import and Export Settings on your machine:




    Click Next.  If you haven't backed up your settings in a while, feel free to do so.  Check out vstipEnv0034 if you want more information on exporting your settings:




    Pick the settings file that has the color scheme you want:




    Click Next.  Verify that the file is ONLY importing Fonts and Colors then click Finish:





    Danger Will Robinson

    That's it!  You should have your new colors.  If things get bad (i.e. you get funky colors and don't have a backup) and you need to get the default colors back all you have to do is go to Tools -> Options -> Fonts and Colors and click "Use Defaults".  Be warned this is a nuclear option for your colors and wipes out any custom colors used:


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