FAKE: How to define MSBuild properties?

社会主义新天地 提交于 2019-11-28 03:28:52

问题


I want to switch from MSBuild to FAKE. In my MSBuild script I create a Webdeploy package by invoking MSBuild with the properties DeployOnBuild=True and DeployTarget=Package. This will trigger webdeploy to generate a deployment package while the build is running:

<MSBuild Projects="@(ItemToBuild)"
         Targets="Build"
         Properties="Configuration=$(Configuration);
                     Platform=$(Platform);
                     DeployOnBuild=True;
                     DeployTarget=Package;
                     OutFolder=$(OutFolder)" />

How can I do the same thing with FAKE? I've come this far:

Target "Build" (fun _ ->
    !! solutionFile
    |> MSBuildRelease binDir "Build"
    |> Log "Build-Output: "
)

How can I specify the required properties?


回答1:


If you look at the source code, you'll see that MSBuildRelease is just a shortcut for MSBuild proper with certain predefined properties. If you need to define other properties, besides "Configuration", you can just fall back to MSBuild:

Target "Build" (fun _ ->
    !! solutionFile
    |> MSBuild binDir "Build" 
         [ 
            "Configuration", "Release"
            "Platform", "AnyCPU"
            "DeployOnBuild", "True"
            "DeployTarget", "Package"
            "OutFolder", "/what/ever"
         ]
    |> Log "Build-Output: "
)


来源:https://stackoverflow.com/questions/34003614/fake-how-to-define-msbuild-properties

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!