When I deploy my apps into a Service Fabric cluster using VSTS, I don’t want to update App version every time. I found “Update only if changed” flag on “Update Service Fabric App Versions” task. However, it doesn’t work when I follow the instruction.
You can see the document it says
Note: By default, the compiler will create different outputs even if you made no changes. Use the deterministic compiler flag to ensure builds with the same inputs produce the same outputs.
It is wrong, at least for VSTS. I’d like to share how can we enable this flag.
1. Update “Update Service Fabric App Versions” configuration
Under this configuration, VSTS compares between this build and the last build’s binary and configuration. VSTS refers the drop folder which is uploaded by the Publish Artifact task.
Update only if change: check Package Artifact Name: drop Compare against: Last Successful Build
2. Enabling deterministic compiler flag
If you search the deterministic compiler flag on the internet, you can find a lot of `/deterministic` flag for MSBuild or edit *.csproj file and add <Deterministic>true</Deterministic> instruction. It is not true for VSTS.
Just add environment variables. The deterministic flag enables you to build the same build from the same source.
3. Remove pdb files.
Even if you set the deterministic flag on, the pdb file still will be changed. Which means, the Update Service Fabric App Versions task think it is a different version because it finds new pdb file.
pdb file is for debugging. It doesn’t need every time. Just remove pdb file for Continuous Integration.
That’s it. Enjoy your Service Fabric with VSTS life.