functions/template-helpers/New-DotNetBuildScript.ps1

# <copyright file="New-DotNetBuildScript.ps1" company="Endjin Limited">
# Copyright (c) Endjin Limited. All rights reserved.
# </copyright>

<#
.SYNOPSIS
    Generates a build script.
.DESCRIPTION
    Generates a build script, from a template, that uses InvokeBuild and functionality available in this module.
.EXAMPLE
    PS C:\> New-DotNetBuildScript -SolutionPath ./src/MySolution/MySolution.sln -Path ./build.ps1
    Generates a build script in the current directory configured to build the specified solution.
.PARAMETER SolutionPath
    The path to the Visual Studio solution associated with this build.
.PARAMETER Path
    The destination path for the generated build script.
.PARAMETER Force
    When true, any existing file.
#>

function New-DotNetBuildScript
{
    [CmdletBinding()]
    param (
        [Parameter(Mandatory=$true)]
        [string] $SolutionPath,

        [Parameter()]
        [string] $Path = "build.ps1",

        [Parameter()]
        [switch] $Force
    )

    $templatePath = "$PSScriptRoot/../../templates/dotnetbuild.ps1.tmpl"

    $newFileContent = Invoke-EpsTemplate -Path $templatePath -Binding $PSBoundParameters
    Set-Content -Value $newFileContent -Path $Path -Force:$Force
}