且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何将 TFS 变量传递给项目的 MSBuild 任务

更新时间:2022-12-12 16:08:34

您可以稍微更改构建过程模板来实现这一点.
默认情况下,与 MSBuild 相关的部分如下所示:

这可以扩展成这样:


如果您现在输入构建定义的MSBuild 参数"(类似于您的图片),则类似于 /p:Version=RePlAcE,你应该得到你需要的.

在另一个你不需要它的构建定义中,只需将条目留空.这种方法可以替代此处,如果不是所有使用它的构建定义都明确需要此版本插入,则应选择它.

You can slightly change your build process template to achieve that.
By default the section that relates to MSBuild looks like this:

This could be expanded into something like this:


If you now enter in "MSBuild Arguments" of your build definition (similar to your picture) something like /p:Version=RePlAcE, you should get what you need.

In another build definition where you don't need this, simply leave the entry empty. This approach is an alternative to the one found here, and should be chosen if this version-insertion is not explicitly desired for all build definitions consuming it.