Visual Studio and ReSharper favorite keyboard shortcuts and snippets

These commands applies to Visual Studio 2012, will probably work in newer versions as well. The Resharper commands are using standard “Visual Studio” keyboard scheme.

Resharper

Used often
Shift+Alt+L (Locate current file in Solution Explorer)
Alt+F7 (Find usages of a class, method or variable in solution)
Ctrl+Click (Goto definition)
Alt+(+) (Alt and plus-key, find members within current file)
Ctrl+T (Goto type, symbol or file name)
Alt+Shift+T (Goto symbol)
Ctrl+Alt+Space (Smart autocomplete for current code)
Alt+Enter (Action list for code at caret)
Ctrl+Shift+R (Refactor this, selected text)
Shift+alt+pgdown – Next error in current file
Shift+alt+pgup – Previous error in current file

Used rarely
Ctrl+Shift+F1 Quick documentation (e.g. small help window for current html/code at caret)
Ctrl+R+R (Rename type/symbol with preview)
Ctrl+Shift+T (Goto file)
Ctrl+, (Recent files)
Ctrl+Shift+, (Recent edits)

Visual Studio

Used often
Ctrl+F (Find in current file)
Ctrl+Shift+F (Find in files)
Ctrl+K, Ctrl+D (Format document)
Ctrl+K, Ctrl+F (Format selection)
Ctrl+K, Ctrl+C Comment line/selection
Ctrl+K, Ctrl+U Uncomment line/selection
Ctrl+Click (With popular extensions Goto definition or Productivity Power Tools)
F12 (Goto definition)
Ctrl+L (Remove line/selection)
Ctrl+D (Duplicate line/selection)
Ctrl+G (Goto line)
Ctrl+Mousewheel (Set editor zoomlevel, a great plugin that keeps zoomlevel consistent in all windows is TroutZoom)

Used rarely
Alt+F1 (MSDN documentation)
Ctrl+Q (Quickfind vs2012+ and with some extension vs2010)
Alt + Select vertical lines with mouse (Expands caret across several lines, insert text on several lines simultaneously)
Ctrl+shift+alt up/down move symbol (e.g method, props etc. within current class/file)
Ctrl+shift+alt left/right move method parameters within method definition.
Ctrl+B (Toggle breakpoint)
Ctrl+Alt+B (Breakpoints list)
Back and forward mouse button (goto to prev/next edit code position)
Ctrl+K, Ctrl+X (Insert snippet)
Left mouse button “triple click” – (Select entire line in vs2012+)

Snippets (enter text and then double tab-key):

nguid – Insert new GUID (Inside a string type: “nguid” and press tab tab)
prop – Insert a shorthand get set property
propfull – Insert a complete get set property with backing private field
ctor – create an parameterless constructor in the class.

Custom keyboard shortcuts

You can add your own keyboard shortcuts through Tools -> Options -> Environment -> Keyboard.
I have added the following:
Ctrl+Alt+B (Build.BuildSelection – this builds the “current” project and not the entire solution).
Ctrl+F12 (Tools.AttachtoIIS – this is a Visual Studio plugin, AttachTo which attaches the debugger to the projects IIS website)
Ctrl+Shift+G (Set keyboard shortcut to Edit.NavigateTo)

To customize the next and previous position re-map keyboard shortcuts to View.NavigateBackward and View.NavigateForward respectively. Use  Ctrl+(-) (Ctrl and minuskey, navigate to previous position) Ctrl+(+) (Ctrl and pluskey, navigate to next position) for instance.

ReSharper Visual Studio scheme keymap

New to ReSharper? A great tip from a colleague of mine is to try to learn a few keyboard shortcuts everyday. 
https://www.jetbrains.com/resharper/docs/ReSharper80DefaultKeymap_VS_scheme.pdf

Visual Studio 2013 really slow when pasting inside ASPX files solved

Whenever I pasted some code in my aspx pages inside Visual Studio got this dialog:
ScreenShot1162

To solve this, I just deleted all the files from this folder:
%USERPROFILE%\AppData\Local\Microsoft\WebSiteCache

Perhaps do a backup first (zip file etc).

Solution from here:
via Slow Visual Studio Performance … Solved! | Geocortex Blog.

Speeding up ASP.NET development environment with a memory ram disk

The basics for these tips are that you are willing to use some of your computer memory to speed things up.

The concept is to use a RAM disk for temporary files storage to speed up the development environment. I am currently using 512 memory on my 8gb Windows 8 pc for the RAM disk.

The tips originates from:
http://blog.lavablast.com/post/2010/12/01/Slash-your-ASPNET-compileload-time.aspx

Step 1. Install Ram disk (free software):
https://sourceforge.net/projects/imdisk-toolkit/
Run ImDisk Ram Disk Configuration.
Set drive to q: and 512mb RAM disk on my 8 gb memory pc, enable “Launch at Windows Startup”.

ScreenShot1126

Above: here the drive size is set to 512mb. Its changeable, its a “temp” drive. Its non persistant everything gets wiped upon system restart.

Step 2. Set asp net temp folders pointed to RAM disk:
(from http://blog.lavablast.com/post/2010/12/01/Slash-your-ASPNET-compileload-time.aspx)
“To speed up the first load time, you can tell IIS to store its temporary files on your RAM disk (or fastest disk) by changing the following setting in your web.config files:

<compilation tempDirectory="q:\temp\iistemp\"> 
... 
</compilation>

You can either change your project files directly, or, if you’ve lazy and have numerous applications running on your development machine (like I do), update the system-wide web.config files. Note that you need to update this for each runtime version of the Framework and, if running a 64-bit machine, for both Framework and Framework64. On my machine, I needed to modify the following files:

1: C:\Windows\Microsoft.NET\Framework\v2.0.50727\CONFIG\Web.config
2: C:\Windows\Microsoft.NET\Framework\v4.0.30319\Config\Web.config
3: C:\Windows\Microsoft.NET\Framework64\v2.0.50727\CONFIG\Web.config
4: C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Config\Web.config

Step 3. Chrome cache pointed to RAM disk:
If you use Chrome as development browser this tip helps you point out the custom cache folder and set a size.
https://href.li/?http://jchaois.blogspot.se/2013/11/chrome-cache-location-and-size.html

Shortcut target value (pointed to q: drive and 100mb cache) :

"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --disk-cache-dir="q:\temp\chromecache" --disk-cache-size=104857600

Regedit value:
Change HKEY_CLASSES_ROOT\ChromeHTML\shell\open\command in Windows registry to

"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --disk-cache-dir="q:\temp\chromecache" --disk-cache-size=104857600 -- "%1"

 

The results
It feels like my computer is “snappier” and faster when surfing in Chrome. But I am not really sure if the time to render first page after build is any faster? It still takes about 1 minute after rebuild of entire solution.

More tweaks

Tell antivirus (for me its just windows defender) to exclude q: folder from scanning. You could also add your base projects folder and Visual Studio folders;
C:\Program Files (x86)\Microsoft Visual Studio 11.0
C:\Program Files (x86)\Microsoft Visual Studio 12.0
C:\Projects

Excluded process:
C:\Windows\System32\inetsrv\w3wp.exe

Create a bat file for starting Visual Studio to enforce Visual Studio temp files to q:
http://www.codewrecks.com/blog/index.php/2009/08/31/speedup-visual-studio-with-ramdisk/

Bat and shortcut file for download:
Visual Studio 2013.zip

Set ReSharper temp files to use system temp as well:
http://johnnycoder.com/blog/2009/12/23/resharper-file-location/

Not sure if this speeds things up: (just another temp folder used by IIS):
http://serverfault.com/questions/89245/how-to-move-c-inetpub-temp-apppools-to-another-disk

How to convert url text to clickable hyperlink in Excel?

How to convert url text to clickable hyperlink in Excel?

Supposing you have multiple urls in your worksheet, but they are not linked, and now you need to convert all the unlinked urls to clickable hyperlinks, as following screenshots shown. Of course, you can double click them one by one to make them clickable, but this will be time consuming if there are lots of urls. How could you convert multiple unlinked urls to clickable hyperlinks automatically in Excel?

via How to convert url text to clickable hyperlink in Excel?.

More tips:
http://stackoverflow.com/questions/2595692/how-do-i-convert-a-column-of-text-urls-into-active-hyperlinks-in-excel

Reconnect a network share with credentials on Windows 8 login

Such as the WD MyCloud network disk…

Create a .bat file and enter this:
net use Z: \\192.168.0.2\Document mysecretpassword /user:MyUserName /persistent:yes

Replace text in bold.

Add a shortcut to the bat file to the Startup folder:
C:\Users\[MyUserName]\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup
Set the shortcut to run in “minimized window” to avoid showing the window.

Technet info for NET command:
http://technet.microsoft.com/en-us/library/bb490717.aspx

Tips and Tricks – Show assembly version numbers in Windows Explorer

Sometimes you want a simple overview of all the assembly file version numbers in the bin folder in your ASP.NET project.

For example when doing an upgrade or a release.

Go to your bin folder -> show files as detailed list in windows explorer.

Right click on one of the columns:
ScreenShot715

Scroll down to file version, or just start typing file to jump fast.
Check “File version”

ScreenShot714

Tada!ScreenShot716