Create plain GUID in Visual Studio via PowerShell

I use GUIDs for ad hoc stuff like passing into postman requests or when inserting dummy data into DBs for testing etc. There’s a lot of GUID generators online so there’s plenty of use cases for generating them outside the context of code.

Instead of going online to get one all the time, it would be nice to have something built into VS.

Indeed Visual Studio does have a built in GUID generator BUT annoyingly it doesn’t output just the GUID but always outputs additional chars and formats which you have to remove manually if you want just the GUID.

The formats available from the built in GUID generator are shown below. Option 4 just has {} around it so it’s the closest to a plain GUID.

Create plain GUID in Visual Studio with PowerShell

Thankfully by calling PowerShell.exe with [guid]::NewGuid() as an argument from the External Tools window we can easily create a ‘plain’ GUID as shown below …

Don’t forget to check the ‘Use Output window’ too.

Leave a Reply

Your email address will not be published. Required fields are marked *