Skip to content

Call MSBuild without specifying a target does not use DefaultTarget #2551

@Diogomrol

Description

@Diogomrol

What You Are Seeing?

When I call MSBuild without specifying WithTarget(), it looks like MSBuild tries to build my project using "Build" target instead of using the file's DefaultTarget.

I'm calling a MSBuild-compatible XML file as the solution input (namely Babel Obfuscator's configuration file, which I can execute through the command line using MSBuild).

What is Expected?

I expected that DefaultTarget would be used if I do not specify any other target.

What version of Cake are you using?

0.33

Are you running on a 32 or 64 bit system?

64

What environment are you running on? Windows? Linux? Mac?

Windows

Are you running on a CI Server? If so, which one?

No, local machine.

How Did You Get This To Happen? (Steps to Reproduce)

Create a target like this:

var obfuscate = Task("Obfuscate")
    .Does(() => {
        MSBuild("obfuscatorConfigurationFile.babel");
    });

Output Log

Microsoft (R) Build Engine version 15.9.21+g9802d43bc3 for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.

Build started 11/05/2019 21:51:34.
Project "C:\svn\branch\ObfuscationConfiguration.babel" on node 1 (Build target(s)).
"C:\svn\branch\ObfuscationConfiguration.babel" (Build target) (1) ->
C:\svn\branch\ObfuscationConfiguration.babel : error MSB4057: The target "Build" does not exist in the project.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions