开发者

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)"/>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜