en-US/psake.psm1-help.xml
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<helpItems schema="maml"> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10"> <command:details> <command:name>Invoke-psake</command:name> <maml:description> <maml:para>Runs a psake build script.</maml:para> </maml:description> <maml:copyright> <maml:para /> </maml:copyright> <command:verb>Invoke</command:verb> <command:noun>psake</command:noun> <dev:version /> </command:details> <maml:description> <maml:para>This function runs a psake build script</maml:para> </maml:description> <command:syntax> <command:syntaxItem> <command:name>Invoke-psake</command:name> <command:parameter require="false" variableLength="false" globbing="false" pipelineInput="false" postion="0"> <maml:name>buildFile</maml:name> <command:parameterValue required="false" variableLength="false">String</command:parameterValue> </command:parameter> <command:parameter require="false" variableLength="false" globbing="false" pipelineInput="false" postion="0"> <maml:name>taskList</maml:name> <command:parameterValue required="false" variableLength="false">String[]</command:parameterValue> </command:parameter> <command:parameter require="false" variableLength="false" globbing="false" pipelineInput="false" postion="0"> <maml:name>framework</maml:name> <command:parameterValue required="false" variableLength="false">String</command:parameterValue> </command:parameter> <command:parameter require="false" variableLength="false" globbing="false" pipelineInput="false" postion="0"> <maml:name>docs</maml:name> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> </command:parameter> <command:parameter require="false" variableLength="false" globbing="false" pipelineInput="false" postion="0"> <maml:name>parameters</maml:name> <command:parameterValue required="false" variableLength="false">Hashtable</command:parameterValue> </command:parameter> <command:parameter require="false" variableLength="false" globbing="false" pipelineInput="false" postion="0"> <maml:name>properties</maml:name> <command:parameterValue required="false" variableLength="false">Hashtable</command:parameterValue> </command:parameter> <command:parameter require="false" variableLength="false" globbing="false" pipelineInput="false" postion="0"> <maml:name>nologo</maml:name> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> </command:parameter> <command:parameter require="false" variableLength="false" globbing="false" pipelineInput="false" postion="0"> <maml:name>notr</maml:name> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> </command:parameter> </command:syntaxItem> </command:syntax> <command:parameters> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false (ByValue)" position="0"> <maml:name>buildFile</maml:name> <maml:description> <maml:para>The path to the psake build script to execute</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>'default.ps1'</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false (ByValue)" position="1"> <maml:name>taskList</maml:name> <maml:description> <maml:para>A comma-separated list of task names to execute</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue /> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false (ByValue)" position="2"> <maml:name>framework</maml:name> <maml:description> <maml:para>The version of the .NET framework you want to use during build. You can append x86 or x64 to force a specific framework. If not specified, x86 or x64 will be detected based on the bitness of the PowerShell process. Possible values: '1.0', '1.1', '2.0', '2.0x86', '2.0x64', '3.0', '3.0x86', '3.0x64', '3.5', '3.5x86', '3.5x64', '4.0', '4.0x86', '4.0x64', '4.5', '4.5x86', '4.5x64', '4.5.1', '4.5.1x86', '4.5.1x64'</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>'3.5'</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false (ByValue)" position="3"> <maml:name>docs</maml:name> <maml:description> <maml:para>Prints a list of tasks and their descriptions</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue /> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false (ByValue)" position="4"> <maml:name>parameters</maml:name> <maml:description> <maml:para>A hashtable containing parameters to be passed into the current build script. These parameters will be processed before the 'Properties' function of the script is processed. This means you can access parameters from within the 'Properties' function! </maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">Hashtable</command:parameterValue> <dev:type> <maml:name>Hashtable</maml:name> <maml:uri /> </dev:type> <dev:defaultValue /> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false (ByValue)" position="5"> <maml:name>properties</maml:name> <maml:description> <maml:para>A hashtable containing properties to be passed into the current build script. These properties will override matching properties that are found in the 'Properties' function of the script.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">Hashtable</command:parameterValue> <dev:type> <maml:name>Hashtable</maml:name> <maml:uri /> </dev:type> <dev:defaultValue /> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false (ByValue)" position="6"> <maml:name>nologo</maml:name> <maml:description> <maml:para>Do not display the startup banner and copyright message.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue /> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false (ByValue)" position="6"> <maml:name>notr</maml:name> <maml:description> <maml:para>Do not display the time report.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue /> </command:parameter> </command:parameters> <command:inputTypes> <command:inputType> <dev:type> <maml:name>None</maml:name> <maml:uri /> <maml:description> <maml:para /> </maml:description> </dev:type> <maml:description /> </command:inputType> </command:inputTypes> <command:returnValues> <command:returnValue> <dev:type> <maml:name>None</maml:name> <maml:uri /> <maml:description> <maml:para></maml:para> </maml:description> </dev:type> <maml:description /> </command:returnValue> </command:returnValues> <command:terminatingErrors /> <command:nonTerminatingErrors /> <maml:alertSet> <maml:title></maml:title> <maml:alert> <maml:para>---- Exceptions ----</maml:para> <maml:para>If there is an exception thrown during the running of a build script psake will set the '$psake.build_success' variable to $false. To detect failue outside PowerShell (for example by build server), finish PowerShell process with non-zero exit code when '$psake.build_success' is $false. Calling psake from 'cmd.exe' with 'psake.cmd' will give you that behaviour.</maml:para> <maml:para></maml:para> </maml:alert> <maml:alert> <maml:para>---- $psake variable ----</maml:para> <maml:para>When the psake module is loaded a variable called $psake is created which is a hashtable containing some variables: $psake.version # contains the current version of psake $psake.context # holds onto the current state of all variables $psake.run_by_psake_build_tester # indicates that build is being run by psake-BuildTester $psake.config_default # contains default configuration # can be overriden in psake-config.ps1 in directory with psake.psm1 or in directory with current build script $psake.build_success # indicates that the current build was successful $psake.build_script_file # contains a System.IO.FileInfo for the current build script $psake.build_script_dir # contains the fully qualified path to the current build script You should see the following when you display the contents of the $psake variable right after importing psake PS projects:\psake> Import-Module .\psake.psm1 PS projects:\psake> $psake Name Value ---- ----- run_by_psake_build_tester False version 4.2 build_success False build_script_file build_script_dir config_default @{framework=3.5; ... context {} After a build is executed the following $psake values are updated: build_script_file, build_script_dir, build_success PS projects:\psake> Invoke-psake .\examples\default.ps1 Executing task: Clean Executed Clean! Executing task: Compile Executed Compile! Executing task: Test Executed Test! Build Succeeded! ---------------------------------------------------------------------- Build Time Report ---------------------------------------------------------------------- Name Duration ---- -------- Clean 00:00:00.0798486 Compile 00:00:00.0869948 Test 00:00:00.0958225 Total: 00:00:00.2712414 PS projects:\psake> $psake Name Value ---- ----- build_script_file YOUR_PATH\examples\default.ps1 run_by_psake_build_tester False build_script_dir YOUR_PATH\examples context {} version 4.2 build_success True config_default @{framework=3.5; ... </maml:para> <maml:para></maml:para> </maml:alert> </maml:alertSet> <command:examples> <command:example> <maml:title>-------------- EXAMPLE 1 --------------</maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code>Invoke-psake</dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>Runs the 'default' task in the '.build.ps1' build script</maml:para> <maml:para /> <maml:para /> <maml:para /> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText /> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title>-------------- EXAMPLE 2 --------------</maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code>Invoke-psake '.\build.ps1' Tests,Package</dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>Runs the 'Tests' and 'Package' tasks in the '.build.ps1' build script</maml:para> <maml:para /> <maml:para /> <maml:para /> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText /> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title>-------------- EXAMPLE 3 --------------</maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code>Invoke-psake Tests</dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This example will run the 'Tests' tasks in the 'default.ps1' build script. The 'default.ps1' is assumed to be in the current directory.</maml:para> <maml:para /> <maml:para /> <maml:para /> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText /> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title>-------------- EXAMPLE 4 --------------</maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code>Invoke-psake 'Tests, Package'</dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This example will run the 'Tests' and 'Package' tasks in the 'default.ps1' build script. The 'default.ps1' is assumed to be in the current directory.</maml:para> <maml:para>NOTE: The quotes around the list of tasks to execute is required if you want to execute more than 1 task.</maml:para> <maml:para /> <maml:para /> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText /> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title>-------------- EXAMPLE 5 --------------</maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code>Invoke-psake .\build.ps1 -docs</dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>Prints a report of all the tasks and their dependencies and descriptions and then exits</maml:para> <maml:para /> <maml:para /> <maml:para /> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText /> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title>-------------- EXAMPLE 6 --------------</maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code>Invoke-psake .\parameters.ps1 -parameters @{"p1"="v1";"p2"="v2"}</dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>Runs the build script called 'parameters.ps1' and passes in parameters 'p1' and 'p2' with values 'v1' and 'v2'</maml:para> <maml:para>Here's the .\parameters.ps1 build script:</maml:para> <maml:para /> <maml:para> properties { $my_property = $p1 + $p2 } task default -depends TestParams task TestParams { Assert ($my_property -ne $null) '$my_property should not be null' }</maml:para> <maml:para /> <maml:para>Notice how you can refer to the parameters that were passed into the script from within the “properties” function. The value of the $p1 variable should be the string “v1” and the value of the $p2 variable should be “v2”.</maml:para> <maml:para /> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText /> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title>-------------- EXAMPLE 7 --------------</maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code>Invoke-psake .\properties.ps1 -properties @{"x"="1";"y"="2"}</dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>Runs the build script called 'properties.ps1' and passes in parameters 'x' and 'y' with values '1' and '2'</maml:para> <maml:para>This feature allows you to over-ride existing properties in your build script.</maml:para> <maml:para /> <maml:para>Here's the .\properties.ps1 build script</maml:para> <maml:para>properties { $x = $null $y = $null $z = $null } task default -depends TestProperties task TestProperties { Assert ($x -ne $null) "x should not be null" Assert ($y -ne $null) "y should not be null" Assert ($z -eq $null) "z should be null" } </maml:para> <maml:para /> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText /> </command:commandLine> </command:commandLines> </command:example> </command:examples> <maml:relatedLinks> <maml:navigationLink> <maml:linkText>Task</maml:linkText> <maml:uri /> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Include</maml:linkText> <maml:uri /> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Properties</maml:linkText> <maml:uri /> </maml:navigationLink> <maml:navigationLink> <maml:linkText>FormatTaskName</maml:linkText> <maml:uri /> </maml:navigationLink> <maml:navigationLink> <maml:linkText>TaskSetup</maml:linkText> <maml:uri /> </maml:navigationLink> <maml:navigationLink> <maml:linkText>TaskTearDown</maml:linkText> <maml:uri /> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Assert</maml:linkText> <maml:uri /> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Framework</maml:linkText> <maml:uri /> </maml:navigationLink> </maml:relatedLinks> </command:command> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10"> <command:details> <command:name>TaskTearDown</command:name> <maml:description> <maml:para>Adds a scriptblock to the build that will be executed after each task</maml:para> </maml:description> <maml:copyright> <maml:para /> </maml:copyright> <command:verb></command:verb> <command:noun></command:noun> <dev:version /> </command:details> <maml:description> <maml:para>This function will accept a scriptblock that will be executed after each task in the build script.</maml:para> </maml:description> <command:syntax> <command:syntaxItem> <command:name>TaskTearDown</command:name> <command:parameter require="false" variableLength="false" globbing="false" pipelineInput="false" postion="0"> <maml:name>teardown</maml:name> <command:parameterValue required="true" variableLength="false">ScriptBlock</command:parameterValue> </command:parameter> </command:syntaxItem> </command:syntax> <command:parameters> <command:parameter required="true" variableLength="false" globbing="false" pipelineInput="false (ByValue)" position="0"> <maml:name>teardown</maml:name> <maml:description> <maml:para>A scriptblock to execute</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ScriptBlock</command:parameterValue> <dev:type> <maml:name>ScriptBlock</maml:name> <maml:uri /> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> </command:parameters> <command:inputTypes> <command:inputType> <dev:type> <maml:name>None</maml:name> <maml:uri /> <maml:description> <maml:para /> </maml:description> </dev:type> <maml:description /> </command:inputType> </command:inputTypes> <command:returnValues> <command:returnValue> <dev:type> <maml:name>None</maml:name> <maml:uri /> <maml:description> <maml:para></maml:para> </maml:description> </dev:type> <maml:description /> </command:returnValue> </command:returnValues> <command:terminatingErrors /> <command:nonTerminatingErrors /> <maml:alertSet> <maml:title></maml:title> <maml:alert> <maml:para></maml:para> </maml:alert> </maml:alertSet> <command:examples> <command:example> <maml:title>-------------- EXAMPLE 1 --------------</maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code>A sample build script is shown below: Task default -depends Test Task Test -depends Compile, Clean { } Task Compile -depends Clean { } Task Clean { } TaskTearDown { "Running 'TaskTearDown' for task $context.Peek().currentTaskName" }</dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>The script above produces the following output:</maml:para> <maml:para>Executing task, Clean... Running 'TaskTearDown' for task Clean Executing task, Compile... Running 'TaskTearDown' for task Compile Executing task, Test... Running 'TaskTearDown' for task Test Build Succeeded</maml:para> <maml:para /> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText /> </command:commandLine> </command:commandLines> </command:example> </command:examples> <maml:relatedLinks> <maml:navigationLink> <maml:linkText>Task</maml:linkText> <maml:uri /> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Include</maml:linkText> <maml:uri /> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Properties</maml:linkText> <maml:uri /> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Invoke-psake</maml:linkText> <maml:uri /> </maml:navigationLink> <maml:navigationLink> <maml:linkText>TaskSetup</maml:linkText> <maml:uri /> </maml:navigationLink> <maml:navigationLink> <maml:linkText>TaskTearDown</maml:linkText> <maml:uri /> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Assert</maml:linkText> <maml:uri /> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Framework</maml:linkText> <maml:uri /> </maml:navigationLink> </maml:relatedLinks> </command:command> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10"> <command:details> <command:name>TaskSetup</command:name> <maml:description> <maml:para>Adds a scriptblock that will be executed before each task</maml:para> </maml:description> <maml:copyright> <maml:para /> </maml:copyright> <command:verb></command:verb> <command:noun></command:noun> <dev:version /> </command:details> <maml:description> <maml:para>This function will accept a scriptblock that will be executed before each task in the build script.</maml:para> </maml:description> <command:syntax> <command:syntaxItem> <command:name>TaskSetup</command:name> <command:parameter require="false" variableLength="false" globbing="false" pipelineInput="false" postion="0"> <maml:name>setup</maml:name> <command:parameterValue required="true" variableLength="false">ScriptBlock</command:parameterValue> </command:parameter> </command:syntaxItem> </command:syntax> <command:parameters> <command:parameter required="true" variableLength="false" globbing="false" pipelineInput="false (ByValue)" position="0"> <maml:name>setup</maml:name> <maml:description> <maml:para>A scriptblock to execute</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ScriptBlock</command:parameterValue> <dev:type> <maml:name>ScriptBlock</maml:name> <maml:uri /> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> </command:parameters> <command:inputTypes> <command:inputType> <dev:type> <maml:name>None</maml:name> <maml:uri /> <maml:description> <maml:para /> </maml:description> </dev:type> <maml:description /> </command:inputType> </command:inputTypes> <command:returnValues> <command:returnValue> <dev:type> <maml:name>None</maml:name> <maml:uri /> <maml:description> <maml:para></maml:para> </maml:description> </dev:type> <maml:description /> </command:returnValue> </command:returnValues> <command:terminatingErrors /> <command:nonTerminatingErrors /> <maml:alertSet> <maml:title></maml:title> <maml:alert> <maml:para></maml:para> </maml:alert> </maml:alertSet> <command:examples> <command:example> <maml:title>-------------- EXAMPLE 1 --------------</maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code>A sample build script is shown below: Task default -depends Test Task Test -depends Compile, Clean { } Task Compile -depends Clean { } Task Clean { } TaskSetup { "Running 'TaskSetup' for task $context.Peek().currentTaskName" }</dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>The script above produces the following output:</maml:para> <maml:para>Running 'TaskSetup' for task Clean Executing task, Clean... Running 'TaskSetup' for task Compile Executing task, Compile... Running 'TaskSetup' for task Test Executing task, Test... Build Succeeded</maml:para> <maml:para /> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText /> </command:commandLine> </command:commandLines> </command:example> </command:examples> <maml:relatedLinks> <maml:navigationLink> <maml:linkText>Task</maml:linkText> <maml:uri /> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Include</maml:linkText> <maml:uri /> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Properties</maml:linkText> <maml:uri /> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Invoke-psake</maml:linkText> <maml:uri /> </maml:navigationLink> <maml:navigationLink> <maml:linkText>FormatTaskName</maml:linkText> <maml:uri /> </maml:navigationLink> <maml:navigationLink> <maml:linkText>TaskTearDown</maml:linkText> <maml:uri /> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Assert</maml:linkText> <maml:uri /> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Framework</maml:linkText> <maml:uri /> </maml:navigationLink> </maml:relatedLinks> </command:command> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10"> <command:details> <command:name>Framework</command:name> <maml:description> <maml:para>Sets the version of the .NET framework you want to use during build.</maml:para> </maml:description> <maml:copyright> <maml:para /> </maml:copyright> <command:verb></command:verb> <command:noun></command:noun> <dev:version /> </command:details> <maml:description> <maml:para>This function will accept a string containing version of the .NET framework to use during build. Possible values: '1.0', '1.1', '2.0', '2.0x86', '2.0x64', '3.0', '3.0x86', '3.0x64', '3.5', '3.5x86', '3.5x64', '4.0', '4.0x86', '4.0x64', '4.5', '4.5x86', '4.5x64', '4.5.1', '4.5.1x86', '4.5.1x64'. Default is '3.5*', where x86 or x64 will be detected based on the bitness of the PowerShell process.</maml:para> </maml:description> <command:syntax> <command:syntaxItem> <command:name>Framework</command:name> <command:parameter require="false" variableLength="false" globbing="false" pipelineInput="false" postion="0"> <maml:name>framework</maml:name> <command:parameterValue required="true" variableLength="false">string</command:parameterValue> </command:parameter> </command:syntaxItem> </command:syntax> <command:parameters> <command:parameter required="true" variableLength="false" globbing="false" pipelineInput="false (ByValue)" position="0"> <maml:name>framework</maml:name> <maml:description> <maml:para>Version of the .NET framework to use during build.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">string</command:parameterValue> <dev:type> <maml:name>string</maml:name> <maml:uri /> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> </command:parameters> <command:inputTypes> <command:inputType> <dev:type> <maml:name>None</maml:name> <maml:uri /> <maml:description> <maml:para /> </maml:description> </dev:type> <maml:description /> </command:inputType> </command:inputTypes> <command:returnValues> <command:returnValue> <dev:type> <maml:name>None</maml:name> <maml:uri /> <maml:description> <maml:para></maml:para> </maml:description> </dev:type> <maml:description /> </command:returnValue> </command:returnValues> <command:terminatingErrors /> <command:nonTerminatingErrors /> <maml:alertSet> <maml:title></maml:title> <maml:alert> <maml:para></maml:para> </maml:alert> </maml:alertSet> <command:examples> <command:example> <maml:title>-------------- EXAMPLE 1 --------------</maml:title> <dev:code> Framework "4.0" Task default -depends Compile Task Compile -depends Clean { msbuild /version }</dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>The script above will output detailed version of msbuid v4</maml:para> <maml:para /> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText /> </command:commandLine> </command:commandLines> </command:example> </command:examples> <maml:relatedLinks> <maml:navigationLink> <maml:linkText>Task</maml:linkText> <maml:uri /> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Include</maml:linkText> <maml:uri /> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Properties</maml:linkText> <maml:uri /> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Invoke-psake</maml:linkText> <maml:uri /> </maml:navigationLink> <maml:navigationLink> <maml:linkText>FormatTaskName</maml:linkText> <maml:uri /> </maml:navigationLink> <maml:navigationLink> <maml:linkText>TaskSetup</maml:linkText> <maml:uri /> </maml:navigationLink> <maml:navigationLink> <maml:linkText>TaskTearDown</maml:linkText> <maml:uri /> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Assert</maml:linkText> <maml:uri /> </maml:navigationLink> </maml:relatedLinks> </command:command> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10"> <command:details> <command:name>FormatTaskName</command:name> <maml:description> <maml:para>This function allows you to change how psake renders the task name during a build.</maml:para> </maml:description> <maml:copyright> <maml:para /> </maml:copyright> <command:verb></command:verb> <command:noun></command:noun> <dev:version /> </command:details> <maml:description> <maml:para>This function takes either a string which represents a format string (formats using the -f format operator see “help about_operators”) or it can accept a script block that has a single parameter that is the name of the task that will be executed.</maml:para> </maml:description> <command:syntax> <command:syntaxItem> <command:name>FormatTaskName</command:name> <command:parameter require="false" variableLength="false" globbing="false" pipelineInput="false" postion="0"> <maml:name>format</maml:name> <command:parameterValue required="true" variableLength="false">String or ScriptBlock</command:parameterValue> </command:parameter> </command:syntaxItem> </command:syntax> <command:parameters> <command:parameter required="true" variableLength="false" globbing="false" pipelineInput="false (ByValue)" position="0"> <maml:name>format</maml:name> <maml:description> <maml:para>A format string or a scriptblock to execute</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String or ScriptBlock</command:parameterValue> <dev:type> <maml:name>String or ScriptBlock</maml:name> <maml:uri /> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> </command:parameters> <command:inputTypes> <command:inputType> <dev:type> <maml:name>None</maml:name> <maml:uri /> <maml:description> <maml:para /> </maml:description> </dev:type> <maml:description /> </command:inputType> </command:inputTypes> <command:returnValues> <command:returnValue> <dev:type> <maml:name>None</maml:name> <maml:uri /> <maml:description> <maml:para></maml:para> </maml:description> </dev:type> <maml:description /> </command:returnValue> </command:returnValues> <command:terminatingErrors /> <command:nonTerminatingErrors /> <maml:alertSet> <maml:title></maml:title> <maml:alert> <maml:para></maml:para> </maml:alert> </maml:alertSet> <command:examples> <command:example> <maml:title>-------------- EXAMPLE 1 --------------</maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code>A sample build script that uses a format string is shown below: Task default -depends TaskA, TaskB, TaskC FormatTaskName "-------- {0} --------" Task TaskA { "TaskA is executing" } Task TaskB { "TaskB is executing" } Task TaskC { "TaskC is executing" }</dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>The script above produces the following output:</maml:para> <maml:para>-------- TaskA -------- TaskA is executing -------- TaskB -------- TaskB is executing -------- TaskC -------- TaskC is executing Build Succeeded!</maml:para> <maml:para /> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText /> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title>-------------- EXAMPLE 2 --------------</maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code>A sample build script that uses a ScriptBlock is shown below: Task default -depends TaskA, TaskB, TaskC FormatTaskName { param($taskName) write-host "Executing Task: $taskName" -foregroundcolor blue } Task TaskA { "TaskA is executing" } Task TaskB { "TaskB is executing" } Task TaskC { "TaskC is executing" }</dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>The preceding example uses the scriptblock parameter to the FormatTaskName function to render each task name in the color blue.</maml:para> <maml:para>Note: the $taskName parameter is arbitrary it could be named anything</maml:para> <maml:para /> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText /> </command:commandLine> </command:commandLines> </command:example> </command:examples> <maml:relatedLinks> <maml:navigationLink> <maml:linkText>Task</maml:linkText> <maml:uri /> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Include</maml:linkText> <maml:uri /> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Properties</maml:linkText> <maml:uri /> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Invoke-psake</maml:linkText> <maml:uri /> </maml:navigationLink> <maml:navigationLink> <maml:linkText>TaskSetup</maml:linkText> <maml:uri /> </maml:navigationLink> <maml:navigationLink> <maml:linkText>TaskTearDown</maml:linkText> <maml:uri /> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Assert</maml:linkText> <maml:uri /> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Framework</maml:linkText> <maml:uri /> </maml:navigationLink> </maml:relatedLinks> </command:command> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10" xmlns:MSHelp="http://msdn.microsoft.com/mshelp"> <!--Generated by PS Cmdlet Help Editor--> <command:details> <command:name>Get-PSakeScriptTasks</command:name> <maml:description> <maml:para>Returns meta data about all the tasks defined in the provided psake script.</maml:para> </maml:description> <maml:copyright> <maml:para /> </maml:copyright> <command:verb>Get</command:verb> <command:noun>PSakeScriptTasks</command:noun> <dev:version /> </command:details> <maml:description> <maml:para>Returns meta data about all the tasks defined in the provided psake script. </maml:para> </maml:description> <command:syntax> <command:syntaxItem> <maml:name>Get-PSakeScriptTasks</maml:name> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="0"> <maml:name>buildFile</maml:name> <maml:description> <maml:para>The path to the psake build script to read the tasks from.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>InformationAction</maml:name> <maml:description> <maml:para /> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>InformationVariable</maml:name> <maml:description> <maml:para /> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> </command:parameter> </command:syntaxItem> </command:syntax> <command:parameters> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="0"> <maml:name>buildFile</maml:name> <maml:description> <maml:para>The path to the psake build script to read the tasks from.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri/> </dev:type> <dev:defaultValue>'default.ps1'</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>InformationAction</maml:name> <maml:description> <maml:para /> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri/> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>InformationVariable</maml:name> <maml:description> <maml:para /> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri/> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> </command:parameters> <command:inputTypes> <command:inputType> <dev:type> <maml:name></maml:name> <maml:uri></maml:uri> <maml:description/> </dev:type> <maml:description> <maml:para /> </maml:description> </command:inputType> </command:inputTypes> <command:returnValues> <command:returnValue> <dev:type> <maml:name></maml:name> <maml:uri></maml:uri> <maml:description/> </dev:type> <maml:description> <maml:para /> </maml:description> </command:returnValue> </command:returnValues> <command:terminatingErrors></command:terminatingErrors> <command:nonTerminatingErrors></command:nonTerminatingErrors> <maml:alertSet> <maml:title></maml:title> <maml:alert> <maml:para /> </maml:alert> </maml:alertSet> <command:examples> </command:examples> <maml:relatedLinks> </maml:relatedLinks> </command:command> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10"> <command:details> <command:name>Include</command:name> <maml:description> <maml:para>Include the functions or code of another powershell script file into the current build script's scope</maml:para> </maml:description> <maml:copyright> <maml:para /> </maml:copyright> <command:verb></command:verb> <command:noun></command:noun> <dev:version /> </command:details> <maml:description> <maml:para>A build script may declare an "includes" function which allows you to define a file containing powershell code to be included and added to the scope of the currently running build script. Code from such file will be executed after code from build script.</maml:para> </maml:description> <command:syntax> <command:syntaxItem> <command:name>Include</command:name> <command:parameter require="false" variableLength="false" globbing="false" pipelineInput="false" postion="0"> <maml:name>fileNamePathToInclude</maml:name> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> </command:parameter> </command:syntaxItem> </command:syntax> <command:parameters> <command:parameter required="true" variableLength="false" globbing="false" pipelineInput="false (ByValue)" position="0"> <maml:name>fileNamePathToInclude</maml:name> <maml:description> <maml:para>A string containing the path and name of the powershell file to include</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> </command:parameters> <command:inputTypes> <command:inputType> <dev:type> <maml:name>None</maml:name> <maml:uri /> <maml:description> <maml:para /> </maml:description> </dev:type> <maml:description /> </command:inputType> </command:inputTypes> <command:returnValues> <command:returnValue> <dev:type> <maml:name>None</maml:name> <maml:uri /> <maml:description> <maml:para></maml:para> </maml:description> </dev:type> <maml:description /> </command:returnValue> </command:returnValues> <command:terminatingErrors /> <command:nonTerminatingErrors /> <maml:alertSet> <maml:title></maml:title> <maml:alert> <maml:para></maml:para> </maml:alert> </maml:alertSet> <command:examples> <command:example> <maml:title>-------------- EXAMPLE 1 --------------</maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code>A sample build script is shown below: Include ".\build_utils.ps1" Task default -depends Test Task Test -depends Compile, Clean { } Task Compile -depends Clean { } Task Clean { }</dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>The script above includes all the functions and variables defined in the ".\build_utils.ps1" script into the current build script's scope</maml:para> <maml:para>Note: You can have more than 1 "Include" function defined in the build script</maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText /> </command:commandLine> </command:commandLines> </command:example> </command:examples> <maml:relatedLinks> <maml:navigationLink> <maml:linkText>Task</maml:linkText> <maml:uri /> </maml:navigationLink> <maml:navigationLink> <maml:linkText>FormatTaskName</maml:linkText> <maml:uri /> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Properties</maml:linkText> <maml:uri /> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Invoke-psake</maml:linkText> <maml:uri /> </maml:navigationLink> <maml:navigationLink> <maml:linkText>TaskSetup</maml:linkText> <maml:uri /> </maml:navigationLink> <maml:navigationLink> <maml:linkText>TaskTearDown</maml:linkText> <maml:uri /> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Assert</maml:linkText> <maml:uri /> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Framework</maml:linkText> <maml:uri /> </maml:navigationLink> </maml:relatedLinks> </command:command> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10"> <command:details> <command:name>Properties</command:name> <maml:description> <maml:para>Define a scriptblock that contains assignments to variables that will be available to all tasks in the build script</maml:para> </maml:description> <maml:copyright> <maml:para /> </maml:copyright> <command:verb></command:verb> <command:noun></command:noun> <dev:version /> </command:details> <maml:description> <maml:para>A build script may declare a "Properies" function which allows you to define variables that will be available to all the "Task" functions in the build script. </maml:para> </maml:description> <command:syntax> <command:syntaxItem> <command:name>Properties</command:name> <command:parameter require="false" variableLength="false" globbing="false" pipelineInput="false" postion="0"> <maml:name>properties</maml:name> <command:parameterValue required="true" variableLength="false">ScriptBlock</command:parameterValue> </command:parameter> </command:syntaxItem> </command:syntax> <command:parameters> <command:parameter required="true" variableLength="false" globbing="false" pipelineInput="false (ByValue)" position="0"> <maml:name>properties</maml:name> <maml:description> <maml:para>The script block containing all the variable assignment statements</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ScriptBlock</command:parameterValue> <dev:type> <maml:name>ScriptBlock</maml:name> <maml:uri /> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> </command:parameters> <command:inputTypes> <command:inputType> <dev:type> <maml:name>None</maml:name> <maml:uri /> <maml:description> <maml:para /> </maml:description> </dev:type> <maml:description /> </command:inputType> </command:inputTypes> <command:returnValues> <command:returnValue> <dev:type> <maml:name>None</maml:name> <maml:uri /> <maml:description> <maml:para></maml:para> </maml:description> </dev:type> <maml:description /> </command:returnValue> </command:returnValues> <command:terminatingErrors /> <command:nonTerminatingErrors /> <maml:alertSet> <maml:title></maml:title> <maml:alert> <maml:para></maml:para> </maml:alert> </maml:alertSet> <command:examples> <command:example> <maml:title>-------------- EXAMPLE 1 --------------</maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code>A sample build script is shown below: Properties { $build_dir = "c:\build" $connection_string = "datasource=localhost;initial catalog=northwind;integrated security=sspi" } Task default -depends Test Task Test -depends Compile, Clean { } Task Compile -depends Clean { } Task Clean { }</dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>Note: You can have more than 1 "Properties" function defined in the build script</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText /> </command:commandLine> </command:commandLines> </command:example> </command:examples> <maml:relatedLinks> <maml:navigationLink> <maml:linkText>Task</maml:linkText> <maml:uri /> </maml:navigationLink> <maml:navigationLink> <maml:linkText>FormatTaskName</maml:linkText> <maml:uri /> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Include</maml:linkText> <maml:uri /> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Invoke-psake</maml:linkText> <maml:uri /> </maml:navigationLink> <maml:navigationLink> <maml:linkText>TaskSetup</maml:linkText> <maml:uri /> </maml:navigationLink> <maml:navigationLink> <maml:linkText>TaskTearDown</maml:linkText> <maml:uri /> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Assert</maml:linkText> <maml:uri /> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Framework</maml:linkText> <maml:uri /> </maml:navigationLink> </maml:relatedLinks> </command:command> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10"> <command:details> <command:name>Task</command:name> <maml:description> <maml:para>Defines a build task to be executed by psake</maml:para> </maml:description> <maml:copyright> <maml:para /> </maml:copyright> <command:verb></command:verb> <command:noun></command:noun> <dev:version /> </command:details> <maml:description> <maml:para>This function creates a 'task' object that will be used by the psake engine to execute a build task. Note: There must be at least one task called 'default' in the build script</maml:para> </maml:description> <command:syntax> <command:syntaxItem> <command:name>Task</command:name> <command:parameter require="false" variableLength="false" globbing="false" pipelineInput="false" postion="0"> <maml:name>Name</maml:name> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> </command:parameter> <command:parameter require="false" variableLength="false" globbing="false" pipelineInput="false" postion="0"> <maml:name>Action</maml:name> <command:parameterValue required="true" variableLength="false">ScriptBlock</command:parameterValue> </command:parameter> <command:parameter require="false" variableLength="false" globbing="false" pipelineInput="false" postion="0"> <maml:name>PreAction</maml:name> <command:parameterValue required="false" variableLength="false">ScriptBlock</command:parameterValue> </command:parameter> <command:parameter require="false" variableLength="false" globbing="false" pipelineInput="false" postion="0"> <maml:name>PostAction</maml:name> <command:parameterValue required="false" variableLength="false">ScriptBlock</command:parameterValue> </command:parameter> <command:parameter require="false" variableLength="false" globbing="false" pipelineInput="false" postion="0"> <maml:name>Precondition</maml:name> <command:parameterValue required="false" variableLength="false">ScriptBlock</command:parameterValue> </command:parameter> <command:parameter require="false" variableLength="false" globbing="false" pipelineInput="false" postion="0"> <maml:name>Postcondition</maml:name> <command:parameterValue required="false" variableLength="false">ScriptBlock</command:parameterValue> </command:parameter> <command:parameter require="false" variableLength="false" globbing="false" pipelineInput="false" postion="0"> <maml:name>ContinueOnError</maml:name> <command:parameterValue required="false" variableLength="false">Boolean</command:parameterValue> </command:parameter> <command:parameter require="false" variableLength="false" globbing="false" pipelineInput="false" postion="0"> <maml:name>Depends</maml:name> <command:parameterValue required="false" variableLength="false">String[]</command:parameterValue> </command:parameter> <command:parameter require="false" variableLength="false" globbing="false" pipelineInput="false" postion="0"> <maml:name>RequiredVariables</maml:name> <command:parameterValue required="false" variableLength="false">String[]</command:parameterValue> </command:parameter> <command:parameter require="false" variableLength="false" globbing="false" pipelineInput="false" postion="0"> <maml:name>Description</maml:name> <command:parameterValue required="false" variableLength="false">String[]</command:parameterValue> </command:parameter> </command:syntaxItem> </command:syntax> <command:parameters> <command:parameter required="true" variableLength="false" globbing="false" pipelineInput="false (ByValue)" position="0"> <maml:name>Name</maml:name> <maml:description> <maml:para>The name of the task</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="false" globbing="false" pipelineInput="false (ByValue)" position="0"> <maml:name>Action</maml:name> <maml:description> <maml:para>A scriptblock containing the statements to execute for the task.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ScriptBlock</command:parameterValue> <dev:type> <maml:name>ScriptBlock</maml:name> <maml:uri /> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false (ByValue)" position="0"> <maml:name>PreAction</maml:name> <maml:description> <maml:para>A scriptblock to be executed before the 'Action' scriptblock. Note: This parameter is ignored if the 'Action' scriptblock is not defined.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">ScriptBlock</command:parameterValue> <dev:type> <maml:name>ScriptBlock</maml:name> <maml:uri /> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false (ByValue)" position="0"> <maml:name>PostAction</maml:name> <maml:description> <maml:para>A scriptblock to be executed after the 'Action' scriptblock. Note: This parameter is ignored if the 'Action' scriptblock is not defined.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">ScriptBlock</command:parameterValue> <dev:type> <maml:name>ScriptBlock</maml:name> <maml:uri /> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false (ByValue)" position="0"> <maml:name>Precondition</maml:name> <maml:description> <maml:para>A scriptblock that is executed to determine if the task is executed or skipped. This scriptblock should return $true or $false</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">ScriptBlock</command:parameterValue> <dev:type> <maml:name>ScriptBlock</maml:name> <maml:uri /> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false (ByValue)" position="0"> <maml:name>Postcondition</maml:name> <maml:description> <maml:para>A scriptblock that is executed to determine if the task completed its job correctly. An exception is thrown if the scriptblock returns $false.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">ScriptBlock</command:parameterValue> <dev:type> <maml:name>ScriptBlock</maml:name> <maml:uri /> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false (ByValue)" position="0"> <maml:name>ContinueOnError</maml:name> <maml:description> <maml:para>If this switch parameter is set then the task will not cause the build to fail when an exception is thrown by the task</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false (ByValue)" position="0"> <maml:name>Depends</maml:name> <maml:description> <maml:para>An array of task names that this task depends on. These tasks will be executed before the current task is executed.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false (ByValue)" position="0"> <maml:name>RequiredVariables</maml:name> <maml:description> <maml:para>An array of names of variables that must be set to run this task.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false (ByValue)" position="0"> <maml:name>Description</maml:name> <maml:description> <maml:para>A description of the task.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> </command:parameters> <command:inputTypes> <command:inputType> <dev:type> <maml:name>None</maml:name> <maml:uri /> <maml:description> <maml:para /> </maml:description> </dev:type> <maml:description /> </command:inputType> </command:inputTypes> <command:returnValues> <command:returnValue> <dev:type> <maml:name>None</maml:name> <maml:uri /> <maml:description> <maml:para></maml:para> </maml:description> </dev:type> <maml:description /> </command:returnValue> </command:returnValues> <command:terminatingErrors /> <command:nonTerminatingErrors /> <maml:alertSet> <maml:title></maml:title> <maml:alert> <maml:para></maml:para> </maml:alert> </maml:alertSet> <command:examples> <command:example> <maml:title>-------------- EXAMPLE 1 --------------</maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code>A sample build script is shown below: Task default -Depends Test Task Test -Depends Compile, Clean { "This is a test" } Task Compile -Depends Clean { "Compile" } Task Clean { "Clean" } The 'default' task is required and should not contain an 'Action' parameter. It uses the 'Depends' parameter to specify that 'Test' is a dependency The 'Test' task uses the 'Depends' parameter to specify that 'Compile' and 'Clean' are dependencies The 'Compile' task depends on the 'Clean' task. Note: The 'Action' parameter is defaulted to the script block following the 'Clean' task. An equivalent 'Test' task is shown below: Task Test -Depends Compile, Clean -Action { $testMessage } The output for the above sample build script is shown below: Executing task, Clean... Clean Executing task, Compile... Compile Executing task, Test... This is a test Build Succeeded! ---------------------------------------------------------------------- Build Time Report ---------------------------------------------------------------------- Name Duration ---- -------- Clean 00:00:00.0065614 Compile 00:00:00.0133268 Test 00:00:00.0225964 Total: 00:00:00.0782496</dev:code> <dev:remarks> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText /> </command:commandLine> </command:commandLines> </command:example> </command:examples> <maml:relatedLinks> <maml:navigationLink> <maml:linkText>Properties</maml:linkText> <maml:uri /> </maml:navigationLink> <maml:navigationLink> <maml:linkText>FormatTaskName</maml:linkText> <maml:uri /> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Include</maml:linkText> <maml:uri /> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Invoke-psake</maml:linkText> <maml:uri /> </maml:navigationLink> <maml:navigationLink> <maml:linkText>TaskSetup</maml:linkText> <maml:uri /> </maml:navigationLink> <maml:navigationLink> <maml:linkText>TaskTearDown</maml:linkText> <maml:uri /> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Assert</maml:linkText> <maml:uri /> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Framework</maml:linkText> <maml:uri /> </maml:navigationLink> </maml:relatedLinks> </command:command> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10"> <command:details> <command:name>Assert</command:name> <maml:description> <maml:para>Helper function for "Design by Contract" assertion checking.</maml:para> </maml:description> <maml:copyright> <maml:para /> </maml:copyright> <command:verb></command:verb> <command:noun></command:noun> <dev:version /> </command:details> <maml:description> <maml:para>This is a helper function that makes the code less noisy by eliminating many of the "if" statements that are normally required to verify assumptions in the code.</maml:para> </maml:description> <command:syntax> <command:syntaxItem> <command:name>Assert</command:name> <command:parameter require="true" variableLength="true" globbing="false" pipelineInput="false" postion="0"> <maml:name>conditionToCheck</maml:name> <command:parameterValue required="true" variableLength="false">Boolean</command:parameterValue> </command:parameter> <command:parameter require="true" variableLength="true" globbing="false" pipelineInput="false" postion="1"> <maml:name>failureMessage</maml:name> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> </command:parameter> </command:syntaxItem> </command:syntax> <command:parameters> <command:parameter required="true" variableLength="false" globbing="false" pipelineInput="false (ByValue)" position="0"> <maml:name>conditionToCheck</maml:name> <maml:description> <maml:para>The boolean condition to evaluate</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">Boolean</command:parameterValue> <dev:type> <maml:name>Boolean</maml:name> <maml:uri /> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="false (ByValue)" position="1"> <maml:name>failureMessage</maml:name> <maml:description> <maml:para>The error message used for the exception if the conditionToCheck parameter is false</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> </command:parameters> <command:inputTypes> <command:inputType> <dev:type> <maml:name>None</maml:name> <maml:uri /> <maml:description> <maml:para /> </maml:description> </dev:type> <maml:description /> </command:inputType> </command:inputTypes> <command:returnValues> <command:returnValue> <dev:type> <maml:name>None</maml:name> <maml:uri /> <maml:description> <maml:para></maml:para> </maml:description> </dev:type> <maml:description /> </command:returnValue> </command:returnValues> <command:terminatingErrors /> <command:nonTerminatingErrors /> <maml:alertSet> <maml:title></maml:title> <maml:alert> <maml:para></maml:para> </maml:alert> </maml:alertSet> <command:examples> <command:example> <maml:title>-------------- EXAMPLE 1 --------------</maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code>Assert $false "This always throws an exception"</dev:code> <dev:remarks> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText /> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title>-------------- EXAMPLE 2 --------------</maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code>Assert ( ($i % 2) -eq 0 ) "$i is not an even number"</dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This exmaple may throw an exception if $i is not an even number</maml:para> <maml:para></maml:para> <maml:para>Note:</maml:para> <maml:para>It might be necessary to wrap the condition with paranthesis to force PS to evaluate the condition so that a boolean value is calculated and passed into the 'conditionToCheck' parameter. Example: Assert 1 -eq 2 "1 doesn't equal 2" PS will pass 1 into the condtionToCheck variable and PS will look for a parameter called "eq" and throw an exception with the following message "A parameter cannot be found that matches parameter name 'eq'" The solution is to wrap the condition in () so that PS will evaluate it first. Assert (1 -eq 2) "1 doesn't equal 2" </maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText /> </command:commandLine> </command:commandLines> </command:example> </command:examples> <maml:relatedLinks> <maml:navigationLink> <maml:linkText>Task</maml:linkText> <maml:uri /> </maml:navigationLink> <maml:navigationLink> <maml:linkText>FormatTaskName</maml:linkText> <maml:uri /> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Include</maml:linkText> <maml:uri /> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Invoke-psake</maml:linkText> <maml:uri /> </maml:navigationLink> <maml:navigationLink> <maml:linkText>TaskSetup</maml:linkText> <maml:uri /> </maml:navigationLink> <maml:navigationLink> <maml:linkText>TaskTearDown</maml:linkText> <maml:uri /> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Properties</maml:linkText> <maml:uri /> </maml:navigationLink> </maml:relatedLinks> <maml:navigationLink> <maml:linkText>Framework</maml:linkText> <maml:uri /> </maml:navigationLink> </command:command> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10"> <command:details> <command:name>Exec</command:name> <maml:description> <maml:para>Helper function for executing command-line programs.</maml:para> </maml:description> <maml:copyright> <maml:para /> </maml:copyright> <command:verb></command:verb> <command:noun></command:noun> <dev:version /> </command:details> <maml:description> <maml:para>This is a helper function that runs a scriptblock and checks the PS variable $lastexitcode to see if an error occcured. If an error is detected then an exception is thrown. This function allows you to run command-line programs without having to explicitly check fthe $lastexitcode variable.</maml:para> </maml:description> <command:syntax> <command:syntaxItem> <command:name>Exec</command:name> <command:parameter require="true" variableLength="true" globbing="false" pipelineInput="false" postion="0"> <maml:name>cmd</maml:name> <command:parameterValue required="true" variableLength="false">ScriptBlock</command:parameterValue> </command:parameter> <command:parameter require="true" variableLength="true" globbing="false" pipelineInput="false" postion="1"> <maml:name>errorMessage</maml:name> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> </command:parameter> </command:syntaxItem> </command:syntax> <command:parameters> <command:parameter required="true" variableLength="false" globbing="false" pipelineInput="false (ByValue)" position="0"> <maml:name>cmd</maml:name> <maml:description> <maml:para>The scriptblock to execute. This scriptblock will typically contain the command-line invocation.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">ScriptBlock</command:parameterValue> <dev:type> <maml:name>Boolean</maml:name> <maml:uri /> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="false (ByValue)" position="1"> <maml:name>failureMessage</maml:name> <maml:description> <maml:para>The error message used for the exception that is thrown.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> </command:parameters> <command:inputTypes> <command:inputType> <dev:type> <maml:name>None</maml:name> <maml:uri /> <maml:description> <maml:para /> </maml:description> </dev:type> <maml:description /> </command:inputType> </command:inputTypes> <command:returnValues> <command:returnValue> <dev:type> <maml:name>None</maml:name> <maml:uri /> <maml:description> <maml:para></maml:para> </maml:description> </dev:type> <maml:description /> </command:returnValue> </command:returnValues> <command:terminatingErrors /> <command:nonTerminatingErrors /> <maml:alertSet> <maml:title></maml:title> <maml:alert> <maml:para></maml:para> </maml:alert> </maml:alertSet> <command:examples> <command:example> <maml:title>-------------- EXAMPLE 1 --------------</maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code>exec { svn info $repository_trunk } "Error executing SVN. Please verify SVN command-line client is installed"</dev:code> <dev:remarks> <maml:para>This example calls the svn command-line client.</maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText /> </command:commandLine> </command:commandLines> </command:example> </command:examples> <maml:relatedLinks> <maml:navigationLink> <maml:linkText>Assert</maml:linkText> <maml:uri /> </maml:navigationLink> <maml:navigationLink> <maml:linkText>FormatTaskName</maml:linkText> <maml:uri /> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Include</maml:linkText> <maml:uri /> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Invoke-psake</maml:linkText> <maml:uri /> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Properties</maml:linkText> <maml:uri /> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Task</maml:linkText> <maml:uri /> </maml:navigationLink> <maml:navigationLink> <maml:linkText>TaskSetup</maml:linkText> <maml:uri /> </maml:navigationLink> <maml:navigationLink> <maml:linkText>TaskTearDown</maml:linkText> <maml:uri /> </maml:navigationLink> </maml:relatedLinks> <maml:navigationLink> <maml:linkText>Framework</maml:linkText> <maml:uri /> </maml:navigationLink> </command:command> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10"> <command:details> <command:name>Invoke-Task</command:name> <maml:description> <maml:para>Executes another task in the current build script.</maml:para> </maml:description> <maml:copyright> <maml:para /> </maml:copyright> <command:verb></command:verb> <command:noun></command:noun> <dev:version /> </command:details> <maml:description> <maml:para>This is a function that will allow you to invoke a Task from within another Task in the current build script.</maml:para> </maml:description> <command:syntax> <command:syntaxItem> <command:name>Invoke-Task</command:name> <command:parameter require="true" variableLength="true" globbing="false" pipelineInput="false" postion="0"> <maml:name>taskName</maml:name> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> </command:parameter> </command:syntaxItem> </command:syntax> <command:parameters> <command:parameter required="true" variableLength="false" globbing="false" pipelineInput="false (ByValue)" position="0"> <maml:name>taskName</maml:name> <maml:description> <maml:para>The name of the task to execute.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> </command:parameters> <command:inputTypes> <command:inputType> <dev:type> <maml:name>None</maml:name> <maml:uri /> <maml:description> <maml:para /> </maml:description> </dev:type> <maml:description /> </command:inputType> </command:inputTypes> <command:returnValues> <command:returnValue> <dev:type> <maml:name>None</maml:name> <maml:uri /> <maml:description> <maml:para></maml:para> </maml:description> </dev:type> <maml:description /> </command:returnValue> </command:returnValues> <command:terminatingErrors /> <command:nonTerminatingErrors /> <maml:alertSet> <maml:title></maml:title> <maml:alert> <maml:para></maml:para> </maml:alert> </maml:alertSet> <command:examples> <command:example> <maml:title>-------------- EXAMPLE 1 --------------</maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code>Invoke-Task "Compile"</dev:code> <dev:remarks> <maml:para>This example calls the "Compile" task.</maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText /> </command:commandLine> </command:commandLines> </command:example> </command:examples> <maml:relatedLinks> <maml:navigationLink> <maml:linkText>Assert</maml:linkText> <maml:uri /> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Exec</maml:linkText> <maml:uri /> </maml:navigationLink> <maml:navigationLink> <maml:linkText>FormatTaskName</maml:linkText> <maml:uri /> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Include</maml:linkText> <maml:uri /> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Invoke-psake</maml:linkText> <maml:uri /> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Properties</maml:linkText> <maml:uri /> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Task</maml:linkText> <maml:uri /> </maml:navigationLink> <maml:navigationLink> <maml:linkText>TaskSetup</maml:linkText> <maml:uri /> </maml:navigationLink> <maml:navigationLink> <maml:linkText>TaskTearDown</maml:linkText> <maml:uri /> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Framework</maml:linkText> <maml:uri /> </maml:navigationLink> </maml:relatedLinks> </command:command> </helpItems> |