Josh Buedel
Josh Buedel

Reputation: 1863

Easiest way to set msbuild logging verbosity in fake?

I have a target that looks like this:

Target "builddotnetcode" (fun _ ->
  !! "../Mercury.sln"
    |> MSBuildRelease null "Clean,Build" 
    |> Log "MercuryBuild - Output: "
)

I want to simply set the verbosity in there somewhere. As far as I can tell from the docs you need to specify the Verbosity member of the MSBuildParams object. But build is the only MSBuildHelper function that provides a way to pass a MSBuildParams. Using build I then need to specify Configuration=Release property, the project list, and remove the pipeline to the Log. It seems like there ought to be a simpler way that does not cause me to redefine the entire task. Am I missing something?

Upvotes: 4

Views: 998

Answers (1)

StonesBG
StonesBG

Reputation: 180

So what i did is the following. The reason i did is it this was as I want to create a log file per solution file that I am building

let loggerConfig : list<MSBuildFileLoggerConfig> = [
  {
    Number = 1
    Filename = Some (baseDir + name + "_build.log")
    Verbosity = Some MSBuildVerbosity.Minimal
    Parameters = Some [MSBuildLogParameter.Append]
  }
]

let setParams defaults =
    { defaults with
        Verbosity = Some MSBuildVerbosity.Minimal
        Targets = ["Build"]
        MaxCpuCount = Some (Some 4)
        FileLoggers = Some loggerConfig
        ToolsVersion = Some "12.0"
        Properties =
          [
            "Optimize", "True"
            "DebugSymbols", "True"
            "Configuration", buildMode
          ]
     }

Lastly the only msbuild task that I could see that will let you override the msbuilddefaults was standard build.

build setParams solution
  |> DoNothing

Upvotes: 3

Related Questions