tasks/Get_ModuleName.build.ps1

<#
    .SYNOPSIS
        This is a build task that resolves and prints the current module name.

    .PARAMETER ProjectPath
        The root path to the project. Defaults to $BuildRoot.

    .PARAMETER BuildInfo
        The build info object from ModuleBuilder. Defaults to an empty hashtable.

    .NOTES
        This is a build task that is primarily meant to be run by Invoke-Build but
        wrapped by the Sampler project's build.ps1 (https://github.com/gaelcolas/Sampler).
#>

param
(
    [Parameter()]
    [System.String]
    $ProjectPath = (property ProjectPath $BuildRoot),

    [Parameter()]
    [System.Collections.Hashtable]
    $BuildInfo = (property BuildInfo @{ })
)

# Synopsis: Resolve and print the module name from the project.
task Get_ModuleName {
    Write-Host -ForegroundColor Yellow "TS: Get_ModuleName"
    $ModuleName = Get-SamplerProjectName -BuildRoot $BuildRoot
    Write-Host -ForegroundColor Yellow "Module Name: $ModuleName"
}