Get-SolutionPath.psm1

<#
.Synopsis
   Automatic Version Tool (AVT)
.DESCRIPTION
  Get Solution Path
.EXAMPLE
   Get-SolutionPath project.sln
#>

function Get-SolutionPath
{
    [CmdletBinding()]
    [Alias()]
    [OutputType([hashtable])]
    Param
    (
        # Solution file (sln)
        [string]
        [Parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$false, HelpMessage="Solution file name")]
        $Solution
    )
    Begin
    {
    }
    Process
    {
        #
        if([System.IO.Path]::IsPathRooted($Solution)){
            $path = [System.IO.FileInfo] $Solution
        }
        else{
            $path = Get-ChildItem -Path ..\ -Filter $Solution -File -Recurse |  Select-Object -First 1
            if ( $null -eq $path ){    throw "Solution $Solution is not found!" }
        }
        #
        $sln =  $path.FullName
        $src = $path.Directory.FullName
        $base = $path.Directory.Parent.FullName
        $devops = [System.IO.Path]::Combine($base,"devops")
        if (-not (Test-Path -Path $devops -PathType Container)) {
            $base = $path.Directory.FullName
            $devops = [System.IO.Path]::Combine($base,"devops")
            if (-not (Test-Path -Path $devops -PathType Container)) { throw "Solution devops is not found!" }
        }
        #
        $output = [System.IO.Path]::Combine($devops,"publish")
        #
        return @{
            Base = $base;
            Src = $src;
            Devops = $devops;
            Sln = $sln; 
            Output = $output;
        }
    }
    End
    {
    }
}
Export-ModuleMember -Function Get-SolutionPath
# SIG # Begin signature block
# MIIIEwYJKoZIhvcNAQcCoIIIBDCCCAACAQExDzANBglghkgBZQMEAgEFADB5Bgor
# BgEEAYI3AgEEoGswaTA0BgorBgEEAYI3AgEeMCYCAwEAAAQQH8w7YFlLCE63JNLG
# KX7zUQIBAAIBAAIBAAIBAAIBADAxMA0GCWCGSAFlAwQCAQUABCCpJema3FMfJM10
# A1zuWQHsVX5IXRdvnUs2ZVVxpnpdnqCCBQ8wggULMIIC86ADAgECAgIApTANBgkq
# hkiG9w0BAQsFADCBoDELMAkGA1UEBhMCU0sxETAPBgNVBAgTCFNsb3Zha2lhMRMw
# EQYDVQQHEwpCcmF0aXNsYXZ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