Monday, September 30, 2013

Dependency graph in visual studio 2012- Understand your code better.



What is Dependency Graph?
Dependency graph help you visualize how your code is written and organized and provide view on code dependencies. This is very useful when you are working with a code that you have not written. With the dependency graph you can easily get an idea of code written by others in a application.

How to create Dependency Graph:

You can easily create dependency graph via architecture menu –>Generate Dependency graph. You will also presented to two options like below.
  1. For Solution
  2. For Include file.
HowtoCreateDepencyGraph

I have created a basic web form application and created a dependency graph for entire solution like below.

DepecnyGraphWithWebapplicationVisualStudio2012

Here you can see, I have created a blank template dependency graph and its showing me all reference and class that it has included.

There are multiple options provide to create graphs and filter graphs like Assembly,Namespace, Interface, Struct, Enumeration, Delegate etc. Once you click on any block it will provide relationship with other block like following.

RealtionShipWithDependencyGraph

There is a option available in solution explorer to create a graph for particular file(s). Like following.

SolutionExplorerDependencyGraph

and once you click new dependency graph it create graph like following.

GraphCreatedFromVisualStudioSolutionExplorer




Synchronized settings with live account Visual Studio 2013.

In the earlier versions of Visual Studio, To import settings and export setting we have to import and export setting manually. There is no way it will directly set the setting with all the Microsoft Visual Studio PC’s. But now with Visual Studio 2013 Synchronized settings feature you can sync all the settings with your live account. So if you have applied one settings one computer and you want to apply the settings in another computer you don’t have to worry about it. Let’s see how its works.

Visual Studio 2013 Live Account:





After installing once you start Visual Studio 2013 It will ask you to login into live account.



Once you logged into that account it will load visual studio.



On the right hand corner you can see your name and it will sync your account setting with that live account. Once you click on ‘Account settings’. It will load the settings page.


Synchronized settings options:

In Tools-> Option Menu there is a setting for Synchronized settings where you enable synchronization for different categories like appearance settings, Environment Aliases,Keyboard shortcut, Start Up and Text Editor.

VisuaStudioSynchronizedSettingsOptions

So, Now you have a simple way to maintain your settings across all your development machines where you have visual studio. It’s very helpful for developers like me where we have tons of personalized settings for visual studio and every time I change some thing or change a shortcut it was difficult to maintain.  That’s it. Hope you like it. Stay tuned for more..

Visual Studio 2013 : Peek Definition a new feature

Peek Definition in Visual Studio 2013:

In the earlier version of Visual Studio, When we need to see the definition of method then we can to right click that method and then click on Go To Definition(F12) and then code will be navigate to that method.


GoToDefinitionVisualStudio2012

Once you click on Go To Definition It will navigate to that method.

MethodFromGotoDefinitionVisualStudiofeature

Now in Visual Studio you have one more feature called Peek Definition(Alt + F12).

PeekDefinitionVisualStudio2013

Once you click on peek definition, It will open a small window and show the definition and code for that method.

PeekDefinitionWindowVisualStudio2013

It’s a nice way to see the code of particular method without moving to another .cs file. Another benefit is that it is a recursive like Go To Definition you can navigate to deeper and deeper without moving to another file.

Visual Studio TICK 2 Use Ctrl+I Instead of Ctrl+F


This tip is mostly for Visual Studio 2010 users: stop using Ctrl_F. Ctrl_F brings up the Find dialog where you can type in your search text, press the <Enter> key to search, and (eventually) close the dialog because it's blocking your view. Instead, use Ctrl_i (for "incremental search"). After pressing Ctrl_i, just start typing and your cursor will skip to the first occurrence of whatever you've typed so far, no dialog required. Often you'll find your cursor sitting on what you were looking for before you've typed in everything you thought you'd need to find it.


After entering your search text, pressing Ctrl_i again will take you to the next matching entry, as will F3 if you'd prefer something more familiar (Ctrl_Shift_i will take you to the previous entry). When you do find what you want, just press <Esc> to end the search and go back to making changes. There is one difference between using Ctrl_i and F3 to go to the next matching entry: when you've visited all the matching entries on the page, F3 pops up a dialog box to tell you so; Ctrl_i just cycles through the entries again.

The one downside of the incremental search is that it only searches within a document. However, that means that I use my Find dialog just for "Entire Solution" searches. While the incremental search ignores the scope setting on the Find dialog, it does pick up the dialog's other settings (e.g. "Match Case").
Why is this tip "mostly for Visual Studio 2010 users"? Because, in Visual Studio 2012, this is also the way that the Find dialog works: it starts searching as soon as you start typing.

Visual Studio TRICK 1

Move line up down with Visual Studio 2013.

During writing code some times we required to move lines of code up and down the earlier we have to cut and paste the line. But with Visual Studio 2013 preview there a short cut to do that and it will be useful when we are refactoring our code and doing some changes. There is a short cut to move lines up with Alt + up arrow keys and same way for moving down Alt+ down keys.

For example I have following code there.

UpArrowKeyMoveLinesvisualStudio2013


Now I am pressing Alt+ Up arrow keys

UpArrowKeyMoveLinesvisualStudio20132
====================================================================


Kubernetes

Prerequisites We assume anyone who wants to understand Kubernetes should have an understating of how the Docker works, how the Docker images...