The scenario – you have a Service Fabric build configured on Visual Studio Team Services (VSTS) as follows:
As you can see from the screenshot, there is a task to generate the Service Fabric deployment package. There were no errors in this task, but don’t assume that everything is OK with the package, something might go wrong when you try to deploy it to a SF cluster.
In order to avoid surprises when deploying the application, you can test the package after its generation using the Test-ServiceFabricApplicationPackage powershell cmdlet.
Add a new Powershell++ task after generating the package and configure it as follows:
The command takes the path to the SF package folder as a parameter. I usually set the SF project as the working folder.
Queuing a new build, you can see the results of the build and in particular the task that tests the SF package:
That’s it! With this solution you will know immediately if something is wrong with the package, saving you from the frustration of a failed deployment. This doesn’t mean that deployments will never fail, but hopefully you will be able to detect most or all of the errors in the deployment package every time you trigger a new build 🙂