Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I get the name of the currently signed-in Visual Studio user in C#?

Does anyone know how to get the name of the user who's currently signed into Visual Studio from C#?

Basically I want my VS extension to be able to greet the user by name (ie whoever's signed in to the current VS session).

like image 932
Yann Duran Avatar asked Sep 07 '25 01:09

Yann Duran


1 Answers

AFAIK, there's no API in VS SDK can support this behavior. So you may have to code to read the related value about current account from Registry using Register.CurrentUser.

Check the answer from Hadi and thanks to him, I think it's what you're after. And it works well for VS2015 and VS2017 after my test.

like image 173
LoLance Avatar answered Sep 08 '25 16:09

LoLance