我已经制作了示例构建脚本,但是由于我的解决方案中有多个项目,因此需要将它们构建到不同的文件夹中。
主要问题是如何获取当前文件的名称,以便将其添加到buildDir字符串中。
Target "BuildApp" (fun _->
!! "**/*.csproj"
-- "*Test*/*.csproj"
-- "**/*Test*.csproj"
-- "**/TextControlEditorLight.csproj"
|> MSBuildRelease buildDir "Build"
|> Log "AppBuild-Output: "
我需要类似(buildDir +“ /” + projectName)之类的东西,我已经在网上搜索了,但没有找到任何东西。
可能有一种更简单的方法(我对所有FAKE库都不熟悉),但是一种方法是显式遍历项目文件,然后一个一个地构建。
该!!
操作符返回的匹配文件的序列。在您的版本中,您只需将它们传递给MSBuildRelease
,但也可以使用Seq.iter
以下方法对其进行迭代:
Target "BuildApp" (fun _->
!! "**/*.csproj"
-- "*Test*/*.csproj"
-- "**/*Test*.csproj"
-- "**/TextControlEditorLight.csproj"
|> Seq.iter (fun project ->
// This function will be called for individual project files and so
// we can do whatever we want here. Like build a single project and
// specify output directory based on the project file name.
[project]
|> MSBuildRelease (buildDir @@ Path.GetFileNameWithoutExtension(project)) "Build"
|> Log "AppBuild-Output: ")
)
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句