Get-MsBuildCommand.psm1

#
<#
.Synopsis
   Automatic Publish Tool (APT)
.DESCRIPTION
   Find msbuild Command
.EXAMPLE
   Get-MsBuildCommand
.NOTES
   Author: Imrich Szolik
#>

function Get-MsBuildCommand() {
    #Build Tools for Visual Studio 2022
    $msbuild = 'C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\MSBuild\Current\Bin\MSBuild.exe'
    if( -not ( Test-Path $msbuild ) ){
        #Professional
        $msbuild = 'c:\Program Files\Microsoft Visual Studio\2022\Professional\MSBuild\Current\Bin\MSBuild.exe'    
        if( -not ( Test-Path $msbuild ) ){
            #Enterprise
            $msbuild = 'c:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\Bin\MSBuild.exe'    
            if( -not ( Test-Path $msbuild ) ){
                #Community
                $msbuild = 'c:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\MSBuild.exe'    
            }
        }
    }
    #
    if( -not ( Test-Path $msbuild ) ){    throw 'Please install VisualStudio 2022 or Build Tools for Visual Studio 2022. [ Download https://visualstudio.microsoft.com/downloads/ ]' }
    return $msbuild
}
Export-ModuleMember -Function Get-MsBuildCommand
# SIG # Begin signature block
# MIIIEwYJKoZIhvcNAQcCoIIIBDCCCAACAQExDzANBglghkgBZQMEAgEFADB5Bgor
# BgEEAYI3AgEEoGswaTA0BgorBgEEAYI3AgEeMCYCAwEAAAQQH8w7YFlLCE63JNLG
# KX7zUQIBAAIBAAIBAAIBAAIBADAxMA0GCWCGSAFlAwQCAQUABCBMw3+wWEbY8jLY
# LJATMyCp5tZGmeIE/uBPdPHyS2iWH6CCBQ8wggULMIIC86ADAgECAgIApTANBgkq
# hkiG9w0BAQsFADCBoDELMAkGA1UEBhMCU0sxETAPBgNVBAgTCFNsb3Zha2lhMRMw
# EQYDVQQHEwpCcmF0aXNsYXZhMRMwEQYDVQQKEwpMb210ZWMuY29tMSswKQYDVQQD
# EyJMb210ZWMuY29tIENlcnRpZmljYXRpb24gQXV0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