Build script template for Invoke-Build
NuGet package Invoke-Build.template
Install the template by this command:
dotnet new install Invoke-Build.template
and uninstall by:
dotnet new uninstall Invoke-Build.template
Change to the target directory and invoke
dotnet new ib [options]
in order to create <directory-name>.build.ps1
in this directory.
Generated build script samples:
- Script1 by
dotnet new ib
- Script2 by
dotnet new ib --restore
- Script3 by
dotnet new ib --bootstrap *
- Script4 by
dotnet new ib --bootstrap 5.7.3 --scope AllUsers
Use the following command for the list of options:
dotnet new ib --help
It creates the standalone script with automatic installation of InvokeBuild
and specifies the required module version.
The script may be invoked on its own directly, i.e. not by Invoke-Build
command.
In this case, the script checks for the InvokeBuild
module
and installs its required version if the module is missing.
The version value *
stands for the command Invoke-Build
, i.e. any installed module or script.
If the command is missing then the latest module version is installed.
Otherwise, the version value specifies the required module version. This version is hardcoded (pinned) in the generated script. Change it manually later in order to upgrade.
If bootstrap
is omitted then the generated script is supposed to be invoked by Invoke-Build
as usual.
This scenario requires installed InvokeBuild
module or Invoke-Build.ps1
script.
This option is used together with -b|--bootstrap
.
It tells where the InvokeBuild
module should be installed if the required version is missing.
Available values are:
CurrentUser
(default) Installs in a location for the current user.AllUsers
(run elevated) Installs in a location for all users.
This switch tells to add the task restore
, to restore packages.
This task is supposed to be called explicitly.
The task build
runs without restoring.