Visual Studio Tip and Tricks: Get Public Key Token for a Strong Named Assembly using VS external tools

I picked up this trick from one of the msdn blog and I have found it useful on many occasions so I thought that I would share it.

In Visual Studio, go to the Tools menu and click the External Tools menu item. This will bring up the External Tools dialog.  The image below shows the information that I have added to add a new menu item called ‘Get SN Public Token’.

The command is the path to sn.exe which can be in different places depending on your VS version. The easiest way to find it is to open a VS Command Prompt and type “where sn.exe”.

The arguments field is set to -T and then the $(TargetPath) variable. The “Use Output Window” option is checked so that the results will be shown in the VS output window. After clicking OK, this will be enabled as a menu item as shown below.

The output for this command will be displayed in the output window. This also works if you have multiple projects in the same solution. Just highlight the project in Solution Explorer and then click the menu item.Happy Coding>;-)


.NET Framework 4.0 New GAC Locations

This is what I observed today;
There are now 2 distinct GAC locations that you have to manage as of the .NET 4.0 Framework release.
The GAC was split into two based on each CLR (2.0, 3.5 AND 4.0). The CLR version used for both .NET Framework 2.0 and .NET Framework 3.5 is CLR 2.0.

To avoid issues between CLR 2.0 and CLR 4.0, the GAC is now split into private GAC’s for each runtime. The main change is that CLR v2.0 applications now cannot see CLR v4.0 assemblies in the GAC..:-)

In previous .NET versions, when I installed a .NET assembly into the GAC (using gacutil.exe or even drag and drop to the c:\windows\assembly or Run assembly directory), I could find it .With .NET 4.0, GAC is now located in the ‘C:\Windows\Microsoft.NET\assembly’ path.

In order to install a dll to the .NET 4.0 GAC it is necessary to use the gacutil found C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\GacUtil.exe In addition, you can no longer use the drag n’ drop (in reality the drag n’ drop really executed the gacutil via a windows explorer extension).unfortunately there is no Windows explorer console available for .Net 4.0..:-(

After you use the gacutil.exe -i {path to dll} you can view that it is indeed in the gac via gacutil -l (which will list all dlls in the gac). I used this command and piped the results to a text file via > out.txt which made it easier to find the recently added component.

Now one more point to remember

For CLR v2.0, you can use C:\Windows\assembly\GAC_MSIL and see the folder representation of the registered assemblies similarly for CLR V4.0 you can use C:\Windows\Microsoft.NET\assembly\GAC_MSIL and see the folders represent the registered assemblies.

Microsoft C# Default Key bindings which I generally use.

Hi Readers,
Here is the list of some keyboard short cuts which I generally use in my daily development tasks, you can download the Full Poster from the Microsoft site. Here is the Download Link

1. Ctrl + . (Implement the interface methods)
2. Ctrl + – (Navigate backward)
3. Ctrl + Shift + – (Navigate forward)
4. F7 (View code)
5. Shift + F7 (View designer or mark ups)
6. Ctrl + G (Go to the line number)
7. Ctrl +F4 (close the current tab)
8. F9 (Insert the breakpoint at the current line)
9. Ctrl + F9 (Disable the break point from the current line).
10. Ctrl + Shift +B (Build the solution)
11. Ctrl + Break (Break the build in between).
12. F3 (Find next)
13. Shift +F3 (Find Previous).
14. F5 (Run the application with hitting the breakpoint).
15. Ctrl + F5 (Run the application without hitting the breakpoint Or Skipping the breakpoint).
16. F12 (go to definition).
17. Ctrl + K + C (Comment out the current line).
18. Ctrl + K + U (Uncomment the current line).
19. Ctrl + K +D (Format document).
20. Ctrl + K + F (Format selected area).
21. Ctrl + K + S (Surround the area with the code snippet).
22. Ctrl + K + X (Surround the area with the code snippet with asking language).
23. Tab 2 times (Invoke snippets from the shortcuts).

Download the file, print it and fix it to your box’s wall. Give it a chance and then you tell me.
PS: Did you already know the Ctrl+Point keybinding? Okay, I am pretty sure you will find many unknown key combinations in the poster