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()
functi开发者_JAVA百科on?
You can use $(USERNAME)
to read the USERNAME
environmental variable.
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
Try out this
<Message Text="$(USERNAME)"/>
精彩评论