Run Guest applications in Service Fabric
Create new Service Fabric Guest application project. I'm using simple
.exe .NET Framework 4.5.2 template, but it can be really anything: powershell script, .NET Core library or even system call...?
To run project simply set Service Fabric project as Startup project and press
F5. Make sure you run in 64bit configuration or Service Fabric will fail.
Okay, your app is running, but not the way you'd like it to. Something is missing, there is logical bug in it or anything else. You make changes to your hosted application (
BlaWriter in my case) and you'd like to redeploy it. There are two way to do it.
One way is to upgrade your package and update it on Service Fabric cluster. This one involves package version incrementation.
First, change your hosted app logic. After that, you have to build it! Remember: your Service Fabric project has link to your
bin directory where your builded application is located.
Once your updated application is builded, increment package versions:
This does require some automatition, but this post does not cover it.
Delete and unprovision service
Another option is to delete deployed service and deploy the new one.
Firstly, delete all instances of service in cluster, then unprovision service.
After that, you can redeploy your service without version change.
Above solutions are for beginners and developers who work with SF quite rarely.
If you work on SF projects day-to-day you should really take a look on Service Fabric SDK. With it you can automate these steps with PowerShell scripts.