The opinions expressed in these materials are my own and are not necessarily those of Microsoft.
Copyright © Microsoft Corporation. All rights reserved. Unless otherwise indicated, all source code provided is licensed under the Microsoft Public License (Ms-PL).
Folks I will be on vacation until 8/5. See you all in a couple of weeks :)
p.s. Unfortunately I’m not going to the great place shown in the picture…
This one is absolutely one of my favorite tips because you don't have to do anything to make it happen! By default in a code file in the editor, when you click a symbol, all instances of the symbol are automatically highlighted in the current document. Highlighted symbols may include declarations and references, and generally anything else that Find All References would return. This includes the names of classes, objects, variables, methods, and properties.
In Visual Basic it will also highlight certain control structures:
All you have to do is click in any symbol and it will automatically highlight any references in the current document. You can navigate through the highlights by using CTRL+SHIFT+DOWN ARROW (forward) or CTRL+SHIFT+UP ARROW (reverse).
So what if you don't like this feature? Well, you can always turn it off by following the instructions below:
VB: Go to Tools | Options | Text Editor | Basic | VB Specific. Uncheck the "Enable highlighting of references and keywords" option.
C#: Go to Tools | Options | Text Editor | C# | Advanced. Uncheck the "Highlight references to symbol under cursor" option.
In the past, finding things deep in the IDE has been a challenge. Visual Studio 2012 introduced Quick Launch (CTRL + Q) which specifically addresses how to dig inside Visual Studio to find features you need. Let’s take a look.
You can find Quick Launch in the upper right corner of the IDE:
The most basic scenario for using Quick Launch is finding an item that you have forgotten (or don’t know) the location of. Let’s say you are interested in something deep in the menu system like viewing your white space. You know what it’s called but can’t remember where it is at. Just press CTRL + Q and enter the word white:
All searches are contains operations so the results will show anything that has the word white anywhere in it. The results are grouped into categories and you simply either select the item from the list using your keyboard, mouse or, if there is a keyboard shortcut listed, take advantage of the shortcut. In this case, you could press CTRL+R, CTRL+W to show the white space and then go on with your work.
There are five categories that your results will fall into when using Quick Launch. Let’s take a look at each of them.
Pretty self-explanatory; this category is at the top of the dialog and will show up to the last 5 most recent items that match the current search criteria. Pay attention to the last part of that sentence. Only if it (a) was used by you before from this dialog and (b) matches the current search criteria will an item show up in the MRU list:
You can search just your Most Recently Used items by preceding any search with @MRU (case doesn’t matter):
This obviously refers to menu items. So if I type in option for a search term the menus section shows menu items that contain the term:
You can filter results to show only commands by preceding any search with @MENU (case doesn’t matter):
The Options category does what you might expect--it shows items that can be found by going to Tools | Options on the Menu Bar:
As with the other categories, you can filter your search to just options by preceding any search with @OPT:
The only real limitation to keep in mind is this type of search doesn’t go beyond the categories and the description the team has put in for any given area. For example, if I type the word document here is the result in the options category:
If I go to the second choice which corresponds to Tools | Options | Environment | Documents (and Tools | Options | Text Editor | C# | Advanced as well):
Take a good look at this result. It appears to be searching the entire Options area but it’s just an illusion. If I look for the word directives (which is on the right-hand side in the last option of the image above) I don’t get anything:
What the team has done is put in a ton of keywords to make the right-hand side “searchable” but it really isn’t indexing the text on that side.
This category is somewhat interesting. It searches file names and paths of open documents for the search criteria but not the text inside the files themselves. There are plenty of tools that can be used to search inside files and the context for Quick Launch is at a higher level. This feature is useful for finding a file when you have several files open:
As with the other categories it, too, can be filtered to search just show open files by putting @DOC at the front of your search:
The last category is new in Visual Studio 2013. It will search installed NuGet packages as well as provide an option to search online:
I don’t happen to have any packages installed in this example but if there were any installed they would show up and/or I could click the link to search online. Just like all the other categories you can use @NUGET to search just for NuGet packages.
You can selectively turn off categories you don’t want to see by typing quick in Quick Launch and selecting the result in Options:
Note: For the old school folks this can be found at Tools | Options | Environment | Quick Launch
Then deselect the special search providers you don’t want:
The next time you run a search it will not show the categories you have turned off in your result set.
As you may have noticed when playing with this feature it doesn’t show all the items in the initial results but does have a number indicating how many items it found:
Clearly not all 156 items in the Options are being shown but notice the message at the bottom of the list. If the results are too large to show we can just press CTRL + Q to show them all. Additionally, if you continue to press CTRL + Q it will cycle through showing all items in all categories and filtering by each category.
By default the search term you use is not persisted between search sessions. So if you search on something:
Then place move the cursor outside the Quick Launch area and go back the search term has been cleared from the area:
Personally, I think this is very annoying to me and thankfully the VS team has a fix. Just go to the Quick Launch in Options area then select Show Search Results From Previous Search When Quick Launch Is Activated option:
The next time you run a search, leave the Quick Launch area, and come back it will retain the search term last used and show you the search results as well.
If for some insane reason you don’t like the Quick Launch feature, you can always turn it off by going to Quick Launch in the options then deselecting the Enable Quick Launch option:
This will remove the Quick Launch area from the IDE:
To bring it back just go to Tools | Options | Environment | Quick Launch and select Enable Quick Launch.
I absolutely love this feature! My passion is around helping people be more productive in the IDE and I think Quick Launch is probably one of the biggest steps forward for discovery of VS features that I have ever seen. I’ve been using it for a long time and am at the point now where I can’t imagine not having it. I hope you enjoy it as much as I do.
You can use Navigate To to search for objects, definitions, or references (symbols) in a solution. If you happen to remember the old Navigate To dialog box then you know it was useful but blocked your view of the code:
The new Navigate To dialog is much less intrusive. Just press CTRL+,[comma] to see the new dialog:
The Navigate To experience will look one of two ways while you are using it. If the symbol is in any open document the relevant line will be highlighted within it:
If the symbol is not in an open document then it will show up in the Preview Tab:
There is only one search option when using Navigate To that will include (or exclude) external items:
At any time you can press ESC to close Navigate To and go back to your original code.
This is a collection of about 4 or 5 tips I wrote on using Box Selection for my book a while back. I think a lot of folks don’t know all the great things you can do with with this feature because they just don’t think about it much.
The traditional use of this feature is to simply have some text you want to get rid of. Let’s say I have multiple lines of code:
And I need to get rid of some extra text. I can simply hold my ALT key and my left mouse button to highlight a vertical selection:
(NOTE: You can also hold the ALT key and use your ARROW keys to get the same result)
Now I can just press the DELETE key to remove the extra text:
While this is the traditional use of Box Selection there is much more here. Let’s take a look at some other things you can do.
Let’s say I want to change “bubba” to “cool” in the example code. Normally I would have to go to each line and replace the entries individually. However, in Visual Studio 2010, we introduced a feature called Zero-Length Box Selection. To use it, just go to where you want to start changing multiple lines of code:
Now you can use ALT+UP (or DOWN) ARROW to make a Zero-Length Box Selection:
(NOTE: You could also use ALT+Left Mouse to do the same thing but it’s a lot harder)
This creates a multi-line cursor (the thin blue line) you can use just like you are editing a single line of code. In this example, just press the BACKSPACE key to begin changing this text:
As you can see, all the lines are changed at the same time! Continue to remove “bubba” and then replace it with “cool”:
Now you have a multi-line cursor you can use to modify several lines at the same time. I love using this feature!
There is actually a faster way we could have replaced “bubba” with “cool” than the example above. Let’s reset the code:
Now, using ALT+Left Mouse or ALT+ARROW keys, select all the “bubba” entries:
And just type the word “cool”:
The word “bubba” will be instantly deleted and you will get a multi-line cursor that allows you to put in the new text.
Another thing you can do is replace one set of text with another. Let’s say we have some variables:
And we want to replace “Int16”, “Int32”, and “Int64” with just “int”. No problem! Just select all the “int” entries and copy (CTRL+C) them:
Now select the destination:
And paste (CTRL+V):
It will replace the old contents with the contents you copied earlier.
You can also use a single selection to replace multiple entries. If I have the following sample code:
I can copy the word “double” (CTRL+C):
Select all the “int” entries:
It will replace every “int” with the word “double” for every line! Another one of my favorites.
As you can see there are a lot of things you can do with Box Selection and Zero-Length Box Selection. Give it a try!
For those that are installing TFS 2013, here is a FAQ from the team to help answer some common questions. The most notable is the Go Live license for this build.
[Note: I added some extra spacing but the emphasis is from the original post]
Now that the Preview has been out for a couple of weeks, we've started to get lots of questions about acquisition and upgrade. This page provides useful information about the upgrade process for the Visual Studio Team Foundation Server 2013 Preview. If you're unfamiliar with the new features available in Visual Studio 2013, see this post for an overview.
This release is a preview, so we do expect there to be some bugs in the product. However, we have been using the Preview in our production environment for months and have had a handful of customers install it prior to release to provide feedback, so it has already been through some vetting. If you feel comfortable upgrading your production server, we will support you. The 2013 Preview is "Go-Live," which means you'll be able to upgrade your data to the next 2013 release when it comes out.
The upgrade process has not changed significantly since TFS 2012. One improvement to be aware of is that just like in the later updates for TFS 2012, the 2013 configuration wizards will persist your Application Tier and Build settings during in-place upgrades. As of 2012.2, we also support upgrading databases involved in SQL AlwaysOn or SQL Mirroring.
Please see our Preview docs on MSDN for instructions on how to perform in-place and migration upgrades. If you need to clone your environment to walk through a practice upgrade, you may reference the TFS 2012 Rangers Upgrade Guide, as the process is still the same. Remember to always take a current, full backup of your TFS data prior to attempting an upgrade!
You may upgrade TFS 2010 (with or without SP1) and any Go-Live version of TFS 2012 to the TFS 2013 Preview. We no longer support upgrades from TFS 2008. If you would like to move from TFS 2008 to TFS 2013, you will need to perform a two-step upgrade by first moving your server to TFS 2010 or 2012 (2012.3 is recommended), and then to TFS 2013.
Yes. The TFS hardware requirements have remained the same, but there are new software requirements. The most notable ones are that TFS 2013 now requires Windows Server 2008 R2 and higher as well as SQL 2012 SP1 (CU2 recommended) and higher. We no longer support Windows Server 2008, SQL Server 2008 R2, or SQL Server 2012 RTM. If you use SharePoint, we now require SharePoint 2010 and higher. For more details on the Preview's system requirements, see our guidance on MSDN.
No, you don't. You can continue to use Visual Studio 2012 clients with the TFS 2013 Preview. The Visual Studio 2010 SP1 client is also compatible with the Preview if you install the 2012 compatibility GDR. We no longer support integration with VS 2008 clients, except for very limited functionality through the MSSCCI provider.
The short answer is no. Every release of TFS fully replaces the previous installation of TFS on your server, so they cannot be removed like patches. There is also no "downgrade" path from a later version of TFS to an earlier one. You can roll back to your previous version of TFS using the backup you took of your data prior to upgrading, which is useful if you experience any issues configuring the TFS 2013 Preview. However, it is not possible to revert any upgraded databases back to their original servicing level, so any work you do after upgrading your server will be lost if you roll back. For more information on how to roll back your server, see the TFS 2012 Rangers Upgrade Guide.
It depends. If you are currently on TFS 2010, you will need to uninstall manually, but if you are on one of the TFS 2012 releases (2012, 2012.1, 2012.2, 2012.3), the TFS 2013 installation process will uninstall your existing instance automatically. This is consistent with the auto-uninstall behavior we had in the TFS 2012 cumulative updates.
No, you cannot. The installation process for the Preview will automatically uninstall TFS 2012 from your box. Note that this behavior is different from the Visual Studio client, where the 2013 Preview CAN be installed side-by-side with the 2012 one. If you want to try out the TFS 2013 Preview without getting rid of your TFS 2012 instance, you need to install it on a different server.
As always, we are interested to hear about any issues you encounter. If you think you've identified a setup-related bug, please email tfcare a*t Microsoft d*ot com. You can use our forums, Connect, UserVoice, or the "Send a Smile/Frown" feature in VS to give any other feedback. Happy dogfooding!
In case you haven’t heard we acquired InCycle’s InRelease Business Unit. Here is information on InRelease from the website (http://www.incyclesoftware.com/inrelease/):
More interesting is the information from Brian Harry (http://blogs.msdn.com/b/bharry/archive/2013/07/10/inrelease-acquisition-is-complete.aspx):
[NOTE: Extra space added by me]
At TechEd, in early June, I announced our agreement to acquire InRelease – a release management product built specifically for Team Foundation Server by InCycle Software. Since then, we’ve received tons of requests for more information, demos, etc. Unfortunately, we’ve only been able to point people at InCycle because the acquisition was not final. I’m happy to say that about a week ago we closed the acquisition and InRelease is now a part of Microsoft.
That doesn’t mean we can start selling it right away. There are a number of things that have to happen in order to enable that – getting it on our price lists, shipping a version that is properly branded, serviceable, etc. All of that will take a few months but there are some good options for you in the interim. Let me share some of them.
Hopefully these two paths will solve everyone’s needs while finish up the changes we need to make.
I also want to say a few words about licensing so you, at least, have a little context on what to expect. We are not ready to announce pricing but I can share a bit about the structure of the licensing.
For now, we are focused on getting InRelease integrated into our on premises product. We will also support our cloud service but that will come a bit later.
Please give it a try and give us any feedback you have. As you might imagine, we are currently working on developing and prioritizing our backlog.
This feature was first introduced in Visual Studio 2005 and, over the years, I’ve heard plenty of arguments for and against using it. Those “against” think this can be used as a crutch to hide bad code and not adhere to good coding techniques. Those “for” think this is a great way to organize your code and get clutter out of the way. I’ll show you how it works and let you decide which group you fall into.
In C++ you create regions by using “#pragma region” with label and “#pragma endregion” (case-specific):
For C# you can eliminate the “pragma” keyword, as well as the quotes around the region name if you desire, and just use “#region” with label and “#endregion” (case-specific):
Visual Basic is just as easy as C# and uses a similar syntax of “#Region” with label and “#End Region” (not case-specific):
Note that the quotes around the region name are required in this example.
The value of creating Regions is twofold. First, they travel with the code so are shared by all team members when using source control. Second, they become part of document outlining and can be collapsed:
or expanded to further organize you code:
Special thanks to Marcus Rangell for reminding me of this tip. As a best practice you might consider putting the name of the region in the End Region line as well:
This technique will work with C++ and C# but not with VB regions.
The best practice is particularly useful when you have nested regions:
The only down side is this doubles up the names in C++ when regions are collapsed:
You will not see this problem in C#.
This is another feature that has been around for a while but a lot of people don’t know about. Got code you use all the time? Start using the Toolbox for more than just controls. When you are in the Editor the Toolbox looks like this:
This is a vast expanse of opportunity! Just select some code you use often and drag it into the Toolbox and see the magic happen:
Now you have code ready to go at anytime! Just place the cursor where you want the code to go:
And double click on the item in your Toolbox to have the code inserted:
You can also Click and Drag where you want the code to go:
There are a few extra things you can do with this feature as well. Here is are a few things to consider.
You can rename the code copy to whatever you would like by RIGHT CLICKING on the item and choosing Rename Item:
You can also create additional tabs beyond the General tab. To organize the code with additional tabs just RIGHT CLICK any open space in the toolbox and choose Add Tab:
This will produce a text box where you can type in the name of the new tab:
Simply enter a name and press ENTER:
And now you can click and drag code into the new area:
You can see the entirety of any code entry by placing your mouse cursor over the item and reading the tooltip:
You can delete any entry or any tab except the General Tab. Simply RIGHT CLICK the item or tab and choose Delete or Delete Tab respectively:
Traditionally when you want to view the definition of a method you place your cursor inside the call:
Then press F12 to go to the document where the definition exists:
But what if you don’t want to leave your current location:
No problem! Just take advantage of the new Peek Definition feature by pressing ALT+F12:
This feature will actually open a small window below the method call so you can view its definition. This makes it very easy to view a definition without losing your place in the current document.
If I want to go to another definition from here I can just place my cursor inside the item:
And press ALT+F12 again. It will update the window to show the new definition:
But something else also happens. Notice the dots showing up in the top right-hand side of the window:
The Peek window is keeping track of the definitions you have been to so you can navigate easily between them:
You can use your mouse to click any of the dots or the forward and back links. Also, as you can see, you can use CTRL+ALT+Minus(-) and CTRL+ALT+Plus(+) to move backward and forward respectively.
I’m not sure what the upper limit is on number of entries it will remember but at 18 entries the More indicators showed up to allow navigating through a higher number of definitions. I suspect the number of entries can go quite high:
The next most obvious question is: “Can I edit the code in this definition window?” Currently the answer is “no” however it is something that is being considered before we ship. Let me know your thoughts.