Tuesday, June 9, 2009

Quickly getting new GUID in text editor

Scenario:
During my sharepoint development I need to generate new Guid's all the time

Solution:
Visual Studio does provide a GuidGen.exe tool, but its kinda multi-step process.
After some research I got the solution - MACRO , my old pal :-)

Step:
1. VS > Macros > Macro Explorer

2. Create a new Module and paste the below Macro code into it


3. Go to VS > Tools > Options

4. Create a key board short cut of your choice , I used Ctrl+Alt+G as shown below


Macro Code:

Sub Create_GUID
Dim sel As TextSelection
sel = DTE.ActiveDocument.Selection
sel.Text = System.Guid.NewGuid.ToString("D").ToLower()
End Sub
Article:
Generating-guids-in-the-visual-studio-ide , Create online guid

Follow on Twitter

0 comments: