$buildVersion = $env:BUILDVER
$moduleName = 'ITD.Infra-Networking-Infoblox'

$manifestPath = Join-Path -Path $env:SYSTEM_DEFAULTWORKINGDIRECTORY -ChildPath "$moduleName.psd1"
$modulePath = Join-Path -Path $env:SYSTEM_DEFAULTWORKINGDIRECTORY -ChildPath "$moduleName.psm1"

## Update build version in manifest
$manifestContent = Get-Content -Path $manifestPath -Raw
$manifestContent = $manifestContent -replace '<ModuleVersion>', $buildVersion

## Update functions to export in manifest
Import-Module $modulePath
$funcStrings = (Get-Module ITD.Infra-Networking-Infoblox).ExportedCommands.Values.Name
$funcStrings = "'$($funcStrings -join "','")'"
$manifestContent = $manifestContent -replace "<FunctionsToExport>", $funcStrings

$manifestContent | Set-Content -Path $manifestPath