简体   繁体   中英

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.

I am not able to get the configuration name to write it into my zip name. I would like to name my zip file in this way: 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.

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

You can use the PlatformConfigurations property of BuildSettings to get the configuration details.

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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