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?
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)"/>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With