lukasz.devel
lukasz.devel

Reputation: 13

Narrow down MSBuild verbosity to limit fake build output

Any ideas how to limit the output generated by the MSBuild task in fake build? I am not so much interested in seeing all compile info details as I am interested in seeing warning messages.

I started using StyleCop.Analyzers and if I get a single warning, it is hard to observe among all messages the build task is generating.

Here's how I have it now:

// Target Build Application
Target "BuildApp" (fun _ ->
    MSBuildRelease buildDir "Build" appReferences
    |> Log "AppBuild-Output: "
)

Upvotes: 1

Views: 364

Answers (1)

Fyodor Soikin
Fyodor Soikin

Reputation: 80744

The most general helper function in the MSBuild helper is MSBuildHelper.build. All other functions are specializations of it.

This function takes a setParams function, which follows a general FAKE pattern: takes default parameters structure and modifies it in some way. To set log verbosity, use the MSBuildParameters.Verbosity field:

Target "BuildApp" (fun _ -> 
    "Project.sln"
    |> MSBuildHelper.build (fun p ->
        { p with
             Properties = [ "OutputPath", buildDir ]
             Verbosity = Some Minimal
             Targets = [ "Build" ] } ) )

Alternatively, you can set the verbosity for the whole build by modifying the MSBuildDefaults structure:

MSBuildDefaults <- { MSBuildDefaults with Verbosity = Some Minimal }

This way, all MSBuild invocations will use minimal verbosity.

Upvotes: 1

Related Questions