Skip to content

Tasks | Misc file tasks

olegz edited this page Mar 16, 2026 · 2 revisions

Misc file tasks

writeText

Writes a text string to the current target file:

"readme.txt" ..> writeText "This file was generated by the build."

In a recipe:

target "version.txt" {
    let! ver = vars.Version
    do! writeText ver
}

copyFrom

Copies a source file to the current target:

"bin/app.config" ..> copyFrom "src/App.config"

copyFile

Copies a file to a specific destination:

do! copyFile "src/App.config" "bin/App.exe.config"

readText

Reads the contents of a text file and records a dependency:

let! content = readText "version.txt"

readAllLines

Reads all lines from a text file:

let! lines = readAllLines "packages.txt"

readAllBytes

Reads the binary contents of a file:

let! data = readAllBytes "image.png"

Clone this wiki locally