MSBuild-从命令行获取目标 [英] MSBuild - Getting the target called from command line

查看:116
本文介绍了MSBuild-从命令行获取目标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人知道如何从MSBuild命令行中获取TARGET(/t)的名称吗?可以调用几种类型的目标,我想在通知用户时使用该属性.

Does anyone know how to get the name of the TARGET (/t) called from the MSBuild command line? There are a few types of targets that can be called and I want to use that property in a notification to users.

示例:

msbuild Project.proj /t:ApplicationDeployment /p:Environment=DEV

我想访问我的.Proj文件中的目标词ApplicationDeployment.

I want access to the target words ApplicationDeployment in my .Proj file.

有可以访问的属性吗?知道如何执行此操作吗?

Is there a property I can access? Any clue how to do this?

编辑:我不想也必须传递属性来获取此信息.

I do not want to have to also pass in a property to get this.

更新:这是基于使用MSBuild脚本的部署脚本的.我的构建服务器不用于部署代码,仅用于构建.构建服务器本身具有可以选择加入的构建通知.

UPDATE: This is based on deployment scripts using MSBuild scripts. My build server is not used for deploying code, only for building. The build server itself has build notifications that can be opted into.

推荐答案

我找到了答案!

<Target Name="ApplicationDeployment" >
    <CreateProperty Value="$(MSBuildProjectName) - $(Environment) - Application Deployment Complete">
      <Output TaskParameter="Value" PropertyName="DeploymentCompleteNotifySubject" />
    </CreateProperty>

我想部分归因于冷漠.不知道该怎么做.

I would like to give partial credit to apathetic. Not sure how to do that.

这篇关于MSBuild-从命令行获取目标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆