05 October, 2006

Creating GUIDs

I’ve been writing a lot of XML files for creating SharePoint 2007 features. Every element is identified with a GUID. That’s a lot of GUID’s to be generated. In the beginning I used the Guidgen tool that ships with Visual Studio.

But that wasn’t very effective. So I wrote a little console app to help me out.

class Program
{
    [STAThread]
     static void Main(string[] args)
     {
         Guid g = Guid.NewGuid();
         Clipboard.SetDataObject(g.ToString("B"), true);
    }
}

Put it in the Quick Launch-bar and boom, everytime I hit it I have a new fresh GUID string in the clipboard.


Tags: ,