Skip to content

Allow setting MSBuild target via MSBuildSettings using a string #2953

@augustoproiete

Description

@augustoproiete

Currently when calling the MSBuild alias with an MSBuildSettings, we need to set the target using the WithTarget extension method.

MSBuild("./my-app.sln", new MSBuildSettings
{
    Configuration = "Release",
    ToolVersion = MSBuildToolVersion.VS2019,
}.WithTarget("Build")); // <<<###

It would be nice if we could use a property, with a string, which would make it more natural when using properties for everything else:

MSBuild("./my-app.sln", new MSBuildSettings
{
    Target = "Build",  // <<<###
    Configuration = "Release",
    ToolVersion = MSBuildToolVersion.VS2019,
});

This property should also understand semicolons as separator for multiple targets and call Targets.Add accordingly.

MSBuild("./my-app.sln", new MSBuildSettings
{
    Target = "Clean;Build",  // <<<###
    Configuration = "Release",
    ToolVersion = MSBuildToolVersion.VS2019,
});

What version of Cake are you using?

1.0.0-rc0001

Would you be willing to send a PR?

Yes!

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions