在 MsBuild 中声明动态配置文件路径
目前,我正在尝试将文件复制到用户配置文件内的某个位置,但在声明动态配置文件名称时遇到问题,例如:
<Target Name="CopyScript">
<MsBuild Projects="JsProject.csproj" />
<Copy SourceFiles="$(ProjectDir)\myScript.js" DestinationFolder="$(systemdrive)\Documents and Settings\$(userProfileName)" />
</Target>
声明动态用户配置文件名称的语法是什么?我是否必须从某个地方获取配置文件名称,或者是否有另一个 MsBuild 任务可以为我找到它?
谢谢。
Currently I'm trying to copy a file to a location inside a user's profile, but hit a problem with declaring dynamic profile name, e.g.:
<Target Name="CopyScript">
<MsBuild Projects="JsProject.csproj" />
<Copy SourceFiles="$(ProjectDir)\myScript.js" DestinationFolder="$(systemdrive)\Documents and Settings\$(userProfileName)" />
</Target>
What is the syntax for declaring a dynamic user profile name? Do I have to get the profile name from somewhere, or is there another MsBuild task which will find it for me?
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您应该能够通过 HOMEDRIVE 和 HOMEPATH 环境变量获得此信息。例如:
当您执行 Demo 目标时,您应该获取当前用户主目录的路径。
You should be able to get this with the HOMEDRIVE and HOMEPATH env variables. For example:
When you execute the Demo target you should get the path to the current users home directory.