During the initial stages of building my Sitecore project using Bitbucket pipelines, I encountered a critical roadblock: a version conflict with the sitecore.cli package. The error message indicated that the manifest file already contained version 5.1.25, conflicting with the desired version, 5.2.113. To address this, a targeted fix involved updating the dotnet-tools.json file manually. In this technical account, I'll provide a detailed walkthrough of this fix.
The Issue: Version Mismatch in sitecore.cli
The error message "Cannot add package. Manifest file already contains version 5.1.25 of the package sitecore.cli" pinpointed a version conflict during the build process. The challenge was to rectify this conflict, ensuring alignment with the required version, 5.2.113.
The Fix: Updating dotnet-tools.json
1. Locate dotnet-tools.json
The first step was to navigate to the directory specified in the error message, typically /opt/atlassian/pipelines/agent/build/.config/. Here, the dotnet-tools.json file resides.
2. Open for Editing
Once located, I opened the dotnet-tools.json file for editing. This can be achieved through any preferred text editor or integrated development environment (IDE).
3. Update sitecore.cli Version
Within the file, I identified the entry for sitecore.cli and manually updated the version number to 5.2.113. This involved changing the existing version, usually set at 5.1.25, to the required version.
4. Save Changes
After making the necessary adjustment, I saved the changes to the dotnet-tools.json file, ensuring that the updated version number for sitecore.cli was persisted.
5. Retry Package Installation
With the file updated, I retried the package installation process. The purpose was to confirm that the correct version, 5.2.113, was now being utilized without encountering the previous version conflict.
6. Verify Compatibility
Before concluding the fix, it was imperative to verify the compatibility of version 5.2.113 with the project's requirements. This involved checking for any additional dependencies or behavioral changes.
Conclusion
By strategically editing the dotnet-tools.json file, specifically updating the version of the sitecore.cli package, the version conflict was successfully resolved. This targeted fix allowed for a seamless build process, ensuring that the correct version was utilized during the Sitecore project development within Bitbucket pipelines. The manual edit of the manifest file provides a precise solution for version conflicts, demonstrating the power of nuanced adjustments in the development workflow. As always, adapt these steps to your specific scenario and leverage the broader development community for insights and collaboration. Happy coding!