Search code examples
packageazure-service-fabric

How to include Publish profile and application parameters in a package of service fabric application for deployment?


I am trying to package Service fabric application, when i do that i have application manifest and service manifest files but i want to include application parameters and Publish profiles as well.


Solution

  • Not sure what CI system you're using but typically there's three parts to make it all work

    1. Package your application output + manifests. This is basically the package location output you get from doing an MSBuild on your sfproj. In below, I'm assuming CI build artifact output go to '$(build.artifactstagingdirectory)'
    /t:Package /p:PackageLocation=$(build.artifactstagingdirectory)\applicationpackage
    
    1. Include a step in your CI build output to copy the the parameter and profile files to another folder - e.g. $(build.artifactstagingdirectory)\projectartifacts
    **\PublishProfiles\*.xml
    **\ApplicationParameters\*.xml
    
    1. Deploy your application. For this, have a look at the Deploy-FabricApplication.ps1 script that's created by Visual Studio when your first created your .sfproj Service Fabric project. This is also used by Visual Studio when you deploy your application to your local development cluster and you essentially have to perform the same steps to deploy to another cluster.

    A simple example assuming your CI artifact output exists in "$(SF_PackagePath)"

    Deploy-FabricApplication.ps1 -ApplicationPackagePath "$(SF_PackagePath)\applicationpackage" -PublishProfileFile "$(SF_PackagePath)\projectartifacts\Local.1Node.xml"