简体   繁体   English

如何从InvokeProcess活动中获取构建配置(“release”,“debug”)

[英]How to get build configuration (“release”, “debug”) from InvokeProcess activity

I added an InvokeProcess activity to generate a zip file after building (I couldn't get a good result with the "package on publish" option) and since my build definition builds my solution for 3 differents configuration ("Preproduction", "Production1", "Production2") I would like to write the configuration name into the zip file name. 我在构建之后添加了一个InvokeProcess活动来生成一个zip文件(我无法通过“发布时的包”选项获得良好的结果)并且因为我的构建定义为3个不同的配置构建了我的解决方案(“Preproduction”,“Production1” ,“Production2”)我想将配置名称写入zip文件名。

I am not able to get the configuration name to write it into my zip name. 我无法获取配置名称将其写入我的zip名称。 I would like to name my zip file in this way: proyectName_Preproduction.zip. 我想用这种方式命名我的zip文件:proyectName_Preproduction.zip。 I don't know how to use defined keyword. 我不知道如何使用已定义的关键字。 $(Configuration) does not work. $(配置)不起作用。

Thks for your help. 求你帮忙。 Sébastien 塞巴斯蒂安

I have found a way to access the list of build configurations but I am not sure how to detect the which configuration is current. 我找到了一种访问构建配置列表的方法,但我不知道如何检测哪个配置是最新的。

You can pass the pre-defined BuildSettings object as a parameter to your custom activity. 您可以将预定义的BuildSettings对象作为参数传递给自定义活动。

[RequiredArgument]
public InArgument<BuildSettings> BuildSettings { get; set; }

You can use the PlatformConfigurations property of BuildSettings to get the configuration details. 您可以使用BuildSettings的PlatformConfigurations属性来获取配置详细信息。

BuildSettings buildSettings = context.GetValue(this.BuildSettings);

if (buildSettings.HasPlatformConfigurations)
{
    foreach (var platformConfiguration in buildSettings.PlatformConfigurations)
    {
        var config = platformConfiguration.Configuration;
    }
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM