How to Re-Enable Create Unit Tests Context Menu In Visual Studio 2012

To re-enable the Create Unit Tests… menu, go to Tools->Customize… to launch the Customize dialog. At the Customize dialog, go to the Commands tab, select the Context menu radio button and choose Editor Context Menus | Code Window.

You will realized that the menu item is actually available in the context menu. 🙂 The VS developers were kind enough to leave it there for us. *HeHe* Click on the Create Unit Tests… menu item and click either Move Up or Move Down. [Note: My screenshot is showing Create Unit Test in singular because I had previously tried to rename it]. Then click Close.

Restart Visual Studio 2012 and whalla! The context menu will be available!

 
Note: This apparently does not work in Visual Studio 2013.
 
Alternative is to use this Visual Studio Extension: Unit Test Generator
 
Advertisements

Get CSS/JS Intellisense In ASP.NET WebForms Using Visual Studio 2013

In Visual Studio 2013, CSS files that are included in your project/solution will now automatically be parsed and all HTML documents will gain CSS class intellisense.

But:

ASPX and other WebForm files using the legacy editor do not benefit from this implementation in VS 2013, but may adopt the new system in future releases.

But you can still use this feature as follows:

  1. right click on the “default.aspx” file in the Solution Explorer
  2. “open with”
  3. select “HTML Editor”
  4. “ok”

Source

 

Navigate To Feature In Visual Studio 2012/2013

Visual Studio’s Navigate to feature allows you to find and navigate to a specific element in your solution. Once you press the Ctrl+, combination and start typing your query*, Visual Studio will display all found elements matching your query, regardless of their type and location. To navigate to a certain element, either select it with cursor keys and press Enter or double click the element.

gte_vs[1]

Emulate Visual Studio 2012’s Solution File Finder in VS.NET 2008 and 2010

image_thumb[1]

“First jump up to that box using the keystroke Ctrl+/. Now type “>of ” and follow with the start of a filename. As fast as you can type, Visual Studio searches your entire solution for a file or path that starts with the characters you type and you can quickly select that file (with the keyboard using the arrow keys if you wish) and open it. If you’re working in a solution with several projects or folders, this can be a significant time saver.

For those of you unfamiliar with the Command Window, you can think of it like an Immediate Window that you use with the debugger, except that instead of controlling the debuggee, you’re controlling Visual Studio. It’s like the VS macro editor, except that everything you type takes immediate effect. To have this conveniently just a Ctrl+/, > keystroke away, especially when “>of ” (short for Open File) is such a convenient acronym to search across your entire solution is awesome.”

Source

Why Does Visual Studio Not Resolve My CSS Class Names or JS Method Names?

“Site-Relative Paths are NOT supported by Visual Studio”. So this was the solution to why I was not getting intellisense in my css. I always use site relative paths for my css files so I needed to add this line in to get Visual Studio to find my css files:

<%--To allow Visual Studio to resolve css class names for Intellisense support, css file path references must be absolute     --%>
    <% if (false) {%>
    <link href="../css/global/app.css" rel="stylesheet" />
    <link href="../css/global/base.css" rel="stylesheet" />
    <% } %>

So now with absolute reference to the css files wrapped inside of the if(false) statement, Visual Studio will be able to find the css file which contains the intellisense information however these file references won’t render on the website since they are wrapped in an if statement that never will resolve to true.

This concept can also be applied to js files and intellisene for methods.

Source

C# “prop” code snippet for getter/setter property auto generation

Within Visual Studio, Just type “prop” and hit tab twice and the following stub will be generated automatically generate a property.

 public int MyProperty { get; set; }

You can find the entire list of snippets here:

In Visual Studio 2005,
C:\Program Files\Microsoft Visual Studio 8\VC#\Snippets\1033\Visual C#

In Visual Studio 2008,
C:\Program Files\Microsoft Visual Studio 9.0\VC#\Snippets\1033\Visual C#

In Visual Studio 2010,
C:\Program Files\Microsoft Visual Studio 10.0\VC#\Snippets\1033\Visual C#