将名为项目的文件夹添加到构建路径
Add Folder named like project to build path
我已经制作了示例构建脚本,但由于我的解决方案中有多个项目,我需要将它们构建到不同的文件夹中。
主要问题是如何获取当前处理文件的名称,以便我可以将其添加到 buildDir 字符串中。
Target "BuildApp" (fun _->
!! "**/*.csproj"
-- "*Test*/*.csproj"
-- "**/*Test*.csproj"
-- "**/TextControlEditorLight.csproj"
|> MSBuildRelease buildDir "Build"
|> Log "AppBuild-Output: "
我需要像 (buildDir + "/" + projectName) 这样的东西,我已经在网上搜索了,但没有找到任何东西。
可能有更简单的方法来做到这一点(我不熟悉 所有 FAKE 库),但一种方法是显式迭代项目文件然后一个一个构建。
!!
运算符returns匹配文件的序列。在您的版本中,您只需将它们传递给 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: ")
)
我已经制作了示例构建脚本,但由于我的解决方案中有多个项目,我需要将它们构建到不同的文件夹中。
主要问题是如何获取当前处理文件的名称,以便我可以将其添加到 buildDir 字符串中。
Target "BuildApp" (fun _->
!! "**/*.csproj"
-- "*Test*/*.csproj"
-- "**/*Test*.csproj"
-- "**/TextControlEditorLight.csproj"
|> MSBuildRelease buildDir "Build"
|> Log "AppBuild-Output: "
我需要像 (buildDir + "/" + projectName) 这样的东西,我已经在网上搜索了,但没有找到任何东西。
可能有更简单的方法来做到这一点(我不熟悉 所有 FAKE 库),但一种方法是显式迭代项目文件然后一个一个构建。
!!
运算符returns匹配文件的序列。在您的版本中,您只需将它们传递给 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: ")
)