Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Cmdlet to create a skeleton Service Fabric application package from the image store. Can be used for partial configuration/data packages upgrades.
function Create-ServiceFabricApplicationPackageSkeleton
{
[CmdletBinding()]
Param
(
[Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)]
[string] $ApplicationTypeName,
[Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)]
[string] $ApplicationTypeVersion,
[Parameter(Mandatory=$true)]
[string] $OutputPath
)
$OutputPath = [IO.Path]::Combine((Get-Location), $OutputPath)
New-Item -Path $OutputPath -ItemType Directory -ErrorAction Ignore | Out-Null
$manifest = Get-ServiceFabricApplicationManifest -ApplicationTypeName $ApplicationTypeName -ApplicationTypeVersion $ApplicationTypeVersion
$manifest | Out-File -FilePath ([IO.Path]::Combine($OutputPath, 'ApplicationManifest.xml'))
$manifestXml = [xml] $manifest;
$serviceManifestRefList = $manifestXml.GetElementsByTagName('ServiceManifestRef')
foreach ($serviceManifestRef in $serviceManifestRefList)
{
$serviceManifestName = $serviceManifestRef.ServiceManifestName
New-Item -Path ([IO.Path]::Combine($OutputPath, $serviceManifestName)) -ItemType Directory -ErrorAction Ignore | Out-Null
$serviceManifest = Get-ServiceFabricServiceManifest -ApplicationTypeName $ApplicationTypeName -ApplicationTypeVersion $ApplicationTypeVersion `
-ServiceManifestName $serviceManifestName
$serviceManifest | Out-File -FilePath ([IO.Path]::Combine($OutputPath, $serviceManifestName, 'ServiceManifest.xml'))
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.