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

    Generates a build script.
    Generates a build script, from a template, that uses InvokeBuild and functionality available in this module.
    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.
    The destination path for the generated build script.
    When true, any existing file.

function New-DotNetBuildScript
    param (
        [string] $SolutionPath,

        [string] $OutputPath = "build.ps1",

        [switch] $Force

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

    # If we're using the default value of OutputPath (i.e. we've not specified it when calling this function),
    # then it won't be part of the PSBoundParameters collection, so we need to add it before calling the
    # underlying template helper
    if ("OutputPath" -notin $PSBoundParameters.Keys) {
        $PSBoundParameters.Add("OutputPath", $OutputPath)

    _executeTemplate -TemplatePath $templatePath @PSBoundParameters