After that we can enter link to clone the voting application.
Once you click on Clone button, we can see that application is ready to open on Solution Explorer.
Now we have to build the solution so that all the dependency DLL will be downloaded on the package folder from NuGet store.
We need to cross check the NuGet package solution to find if any DLL is deprecated. If so, then we need to update all older version of DLL.
After correcting the DLL version, we have to check the application file 'voting.sfproj'
Note – For Visual Studio 2022, toolsVersion will be 16.0 and we have to update the MS build version everywhere in the 'voting.sfproj' file.
From packages.config file, we can get the MS build version:
We must cross check the dotnet version in 'packages.config' of the application and also at the service level.
Like in 'packages.config' is having the net40 but in service dotnet version net472.
We have to manually add the reference of MS build in service project file.
Expected error based on above changes –
We must push our changes to our repo. However, prior that we must take care that we should not push our changes on master branch. We need to create a new branch and push our changes to that branch.
For that, In Visual Studio we can go to Team Explorer
After that sync the local branch on DevOps repo.
Now we have to create a Pipeline – Click on New Pipeline
Then click in Use Classic Editor --> select the repository.
Select the template – search for Service Fabric template-
After that all the Task will be generated.
In Agent Specification we need to select the same version as Visual Studio version. Like we have selected the 2019 because we have built the project on VS 2019.
Use NuGet latest stable version. At time of this blog creation, NuGet version is 5.5.1. Also uncheck the checkbox “Always download the latest matching version”.
In Build solution we must select 2019 as my Visual Studio version is 2019.
In “Update Service Fabric Manifest” task we can directly change the version in manifest.
In Copy files – we can gather the data from application manifest and application parameters file.
Please refer below image for above points (19-23)
Enable continuous integration checkbox, so that whenever we do any commit on the repo Automatically the build pipeline is triggered.
We can add some static variables while executing the pipeline by putting the value in variable.
Build Success mail –
Build failed mail-
Release pipeline is the final step where application is deployed to the cluster.
2. Click on “New Release Pipeline” then again select the template for Service Fabric.
3. Then add the Artifact by selecting the correct build pipeline.
4. Click on 1 job,1 task
5. Click on stages --> then we have to select the cluster connection. If no cluster connection is created, then click on “New”
6. Create a Service Connection as given in below image-
Note: - For Azure Active Directory credentials, add the Server certificate thumbprint of the server certificate used to create the cluster and the credentials you want to use to connect to the cluster in the Username and Password fields.
7. How to generate the client certificate value –
Open to PowerShell ISE with Admin access.
Paste the command- [System.Convert]::ToBase64String([System.IO.File]::ReadAllBytes("C:\Users\pritamsinha\Downloads\certi\certestuskv.pfx").
Paste the output in the same PowerShell workspace area and remove all the space from beginning and end.
8. In case of some error with base 64 value then deployment will fail-
Enable Grant access permission to all pipelines.
Note – in case when cluster certificate is expired, and we have updated the cluster certificate then we need to update the thumbprint and client certificate value.
Post above, Deploy Service Fabric application section –
In Application Parameter – We need to select the target location of the file where the application parameter file is placed.
Enable compressed package so that application package will be converted to zip file.
CopyPackageTimeoutSec-Timeout in seconds for copying application package to image store. If specified, this will override the value in the published profile.
RegisterPackageTimeoutSec -Timeout in seconds for registering or un-registering application package.
Enable the Skip upgrade for same Type and Version (Indicates whether an upgrade will be skipped if the same application type and version already exists in the cluster, otherwise the upgrade fails during validation. If enabled, re-deployments are idempotent.)
Enable the Unregister Unused Versions (Indicates whether all unused versions of the application type will be removed after an upgrade.)
Configure the “Continuous deployment trigger” –
Then save the config and run the release pipeline.