Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get the current logged in Windows User from MSBuild

How can we get the current logged-in windows user from Msbuild? Is there a similar way to get it, just as we can do with Nant with the environment::get-user-name() function?

like image 837
stranger789 Avatar asked Jul 25 '11 12:07

stranger789


3 Answers

You can use $(USERNAME) to read the USERNAME environmental variable.

like image 168
Alex K. Avatar answered Nov 05 '22 04:11

Alex K.


Your best bet is probably to use the environment variables

%UserName%
%UserDomain%

Just open a command window and type set to see what's defined. In MSBuild, these would be defined as $(USERNAME) and $(USERDOMAIN) - see MSDN, How To Use an Environment Variables in a Build

like image 27
Tim Long Avatar answered Nov 05 '22 06:11

Tim Long


Try out this

<Message Text="$(USERNAME)"/>
like image 3
sll Avatar answered Nov 05 '22 06:11

sll