2015-11-29 52 views
1

我已经做了示例构建脚本,但由于我有我的解决方案中的几个项目,我需要他们内置到不同的文件夹。添加名为像项目的文件夹构建路径

主要问题是如何获取当前处理文件的名称,以便将其添加到buildDir字符串中。我需要的东西像(buildDir +“/”+ projectName),我已经搜索网络,但没有找到任何东西。

回答

1

有可能是一个更简单的方法来做到这一点(我不熟悉所有 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: ") 
) 
+0

的作品就像一个魅力:)谢谢! – Thoor

相关问题