【问题标题】:FAKE (F# Make) - Is it possible to ignore compiler warnings for a given build target?FAKE (F# Make) - 是否可以忽略给定构建目标的编译器警告?
【发布时间】:2016-11-26 12:47:15
【问题描述】:

标题说明了一切。

我想忽略编译器警告并停止为某个构建目标记录它们。

我正在使用与此类似的语句进行构建,并希望能够传递参数或更改语句以抑制编译器警告:

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

我用谷歌搜索了一些文档,但没有找到任何东西

【问题讨论】:

    标签: build msbuild f#-fake


    【解决方案1】:

    WarningLevel 构建属性应该可以解决问题。如下所示:

    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"])
        )
    

    【讨论】:

      猜你喜欢
      • 2019-05-22
      • 2014-04-03
      • 1970-01-01
      • 2021-05-29
      • 2012-06-24
      • 2011-07-12
      • 2011-06-10
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多