Create GUID Tool in Visual Studio

This article is also available on the Microsoft TechNet Wiki.

A globally unique identifier or GUID is an id that is exclusive throughout the globe. They are usually 128 bits long and are shown in hexadecimal groups separated by hyphens.

Within Visual Studio there exists a standalone tool (guidgen.exe) that allows developers to create GUIDs in a specific format. Creating GUIDs in code is easy enough but perhaps you need to generate one (for a constant or while unit testing) without running your code. This tool can help with that.

Creating GUIDs

  1. To find the tool, open Visual Studio and click Tools > Create GUID.GUID_01
  2. The Create GUID window will appear.
    GUID_02
  3. There are seven different GUID formats to choose from. As you move through the types, the Result window will display what the GUID value will look like.
  4. If you want a different GUID, click the New GUID button.
  5. Once you are happy with your result, click the Copy button to save it to the Clipboard. You can then paste it to your desired locale.
  6. Click Exit to close the dialog window.

Troubleshooting

If the tool does not appear under the Tools menu, click Tools > External Tools (see top image). It may be that the tool was not registered correctly within the IDE. Using the External Tools window, we can add a reference to guidgen.exe.

  1. Click the Add button. A new tool will be added to the Menu contents.
  2. Fill in the fields like so:
    • Enter a Title of Create &GUID. The ampersand will create a hotkey using the letter G.
    • For the Command field, browse to the Tools folder of your current Visual Studio install and find guidgen.exe. This location will typically be %Installation Path%\Microsoft Visual Studio {Version Number}\Common7\Tools\guidgen.exe. For Visual Studio 2015, the full path will look like this: C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\Tools. NOTE: You can also double click the exe here to run it. You will see the same Create GUID UI as above.
    • For the Initial directory, use the guidgen.exe root folder or %Installation Path%\Microsoft Visual Studio {Version Number}\Common7\Tools\
  3. When you are done, your entry should look something like this:GUID_03
  4. Click OK.
  5. Your tool should now appear in the Tools menu.

See Also

Advertisements

About Ken Cenerelli
I am a Programmer Writer, .NET Developer, Microsoft MVP - Visual Studio and Development Technologies, Public Speaker, Blogger, and Microsoft Azure Nerd. I blog regularly at kencenerelli.wordpress.com and can be found on Twitter via @KenCenerelli.

One Response to Create GUID Tool in Visual Studio

  1. Pingback: 2016 Year in Review | Ken Cenerelli

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: