I've got a little Powershell script that is supposed to deploy some service fabric applications locally:
I'm attempting to execute it like this:
.\Deploy.ps1 -ArtifactPath C:\packages\EnterpriseAPIPackages201710109749b
For some reason it skips to the last line of the script!
What am I doing wrong? How do I get all the lines to execute?
Param
(
[String]
$ArtifactPath
)
$LocalFolder = Split-Path -parent $MyInvocation.MyCommand.Path
$DeployScriptFile = "$LocalFolder\Scripts\Deploy-FabricApplication.ps1"
$ConfigFilePath = "$LocalFolder\config.xml"
$ConfigFilePath = Resolve-Path $ConfigFilePath
[Xml]$configParameters = (Get-Content $ConfigFilePath)
$services = $configParameters.DeploymentConfiguration.Microservices
if (!$ArtifactPath)
{
$ArtifactPath = $LocalFolder
}
$ApplicationPackageFiles = Get-ChildItem -Path $ArtifactPath -Filter ApplicationManifest.xml -Recurse -Force -ErrorAction SilentlyContinue
foreach($ApplicationPackageFile in $ApplicationPackageFiles)
{
$ApplicationPackagePath = Split-Path -Parent -Path $($ApplicationPackageFile.FullName)
$ProjectName = Split-Path $ApplicationPackagePath -Leaf
Write-Host "Start PowerShell script to deploy Microservice to Service Fabric: ApplicationPackageName: $($ProjectName)"
$ScriptBlock = [ScriptBlock]::Create("$DeployScriptFile -ApplicationPackagePath '$ApplicationPackagePath'")
Invoke-Command -ScriptBlock $ScriptBlock
}
Read-Host -Prompt "Press Enter to exit"
