You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Having to have a build script file is a nuisance in some scenarios. It would be
useful to define, assemble, import, and invoke tasks using just script blocks.
The required change is simple and backward compatible. The parameter File
accepts either a script block (new) or a script path (usual).
Example of a script block used as the parameter File:
Invoke-Build<tasks> {
...
}
The script block either defines the whole build itself or assembles it from
external task scripts. It is possible to alter or redefine tasks, add new
tasks, and set build blocks on the fly.
What are the conventional $BuildFile and $BuildRoot? $BuildFile is
informational and not so important. But $BuildRoot is very important,
it is maintained as the current location for build blocks.
One possible convention:
$BuildFile is the calling script.
$BuildRoot is its directory.
Note that $BuildFile may be null in cases like jobs, calls from .NET, "run
selection" in some IDE with PowerShell hosting, etc. In such cases we will
just use the current location as the default $BuildRoot.
In any case, if the default $BuildRoot is not suitable then it may be set to
a required full path explicitly in a build code (documented feature).
The text was updated successfully, but these errors were encountered:
This seems really helpful actually, I could include a check for Invoke-Build in my build script and install it from the Gallery before running Invoke-Build with my task definitions, all without needing 2 separate scripts.
Having to have a build script file is a nuisance in some scenarios. It would be
useful to define, assemble, import, and invoke tasks using just script blocks.
The required change is simple and backward compatible. The parameter
File
accepts either a script block (new) or a script path (usual).
Example of a script block used as the parameter
File
:The script block either defines the whole build itself or assembles it from
external task scripts. It is possible to alter or redefine tasks, add new
tasks, and set build blocks on the fly.
What are the conventional
$BuildFile
and$BuildRoot
?$BuildFile
isinformational and not so important. But
$BuildRoot
is very important,it is maintained as the current location for build blocks.
One possible convention:
$BuildFile
is the calling script.$BuildRoot
is its directory.Note that
$BuildFile
may be null in cases like jobs, calls from .NET, "runselection" in some IDE with PowerShell hosting, etc. In such cases we will
just use the current location as the default
$BuildRoot
.In any case, if the default
$BuildRoot
is not suitable then it may be set toa required full path explicitly in a build code (documented feature).
The text was updated successfully, but these errors were encountered: