简体   繁体   中英

FAKE (F# Make) - Is it possible to ignore compiler warnings for a given build target?

The title says it all really.

I want to ignore compiler warnings & stop them being logged for a certain build target.

I am building with a statement similar to this and want to be able to pass a parameter or change the statement to suppress compiler warnings:

Target "BuildConfigX" (fun _ ->
    !! "**/*.csproj"
    |> MSBuildDebug buildDir "Build"
    |> Log "AppBuild-Output")

I had a bit of a google and a bit of a hunt through the docs but couldn't find anything

The WarningLevel build property should potentially do the trick. Something like below:

let buildProject outputDir buildTargets projectName = 
    let propertiesCommon =            
                [   "DevEnvDir", "C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\Tools"
                    "OutputPath", outputDir
                    "Optimize", "True"
                    "DebugSymbols", "True"
                    "Configuration", buildMode ]
    let properties = 
        match buildMode with
            | "Release" -> propertiesCommon @ ["WarningLevel", "0"] //<--
            | _ -> propertiesCommon

    let setParams defaults =
        { defaults with
            Verbosity = Some(Minimal)
            Targets = buildTargets
            Properties = properties
        }
    build setParams projectName |> DoNothing


Target "BuildConfigX" (fun _ ->
    !! "**/*.csproj"
    |> Seq.iter (buildProject buildOutDir ["ReBuild"])
    )

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