Search code examples
azureazure-service-fabric

How can I take advantage of ServiceFabric Autorefresh?


I recently read about ServiceFabric offering some kind of Autorefresh mode, considering its infrastructure and the cluster running independently.

So, according to what I've wrote, all I need to do it go to my project, check the properties and set the "Application Debug Mode" to Refresh Application.

Basically that is what I did now, but I don't quite see the difference. There's no repackaging happening at all.

Do I have to run some kind of cmdlet in the background, as it is the case with e.g. webpack watch?


Solution

  • The docs explains Refresh Application as follow.

    Refresh Application This mode enables you to quickly change and debug your code and supports editing static web files while debugging. This mode only works if your local development cluster is in 1-Node mode. This is the default Application Debug Mode.

    On other application debug options, Visual Studio creates a package and deploy it to the cluster and register the application to run on Service Fabric, the package will contain all binaries compiled that are needed to run the application.

    The main difference between the Refresh Application and the others, is that the package created is a symbolic link to the source in the Dev machine, you are not actually copying the package with the binaries, when you change the static files, it will be the same files used by the deployed application in SF, this will make more flexible to make changes without repackaging, registering and deploying the application on every change.

    PS: It does not work the same way as the watch feature for nodeJs development, it is just to avoid the package deployment. You could just reload the page though.

    This post explain in more details.