In this blog, I will discuss about setting up the deploying the Sitecore TDS packages to different environments using TFS build server. So, the requirement is to create a Sitecore build and deploy on On-Prem TFS build server. This needs to be set up from the scratch, so I needed to set up a simple TDS build and release process, so the client can move the code and change the Sitecore content from different environments.
I looked into some of the online help and found some help at https://theagilecoder.wordpress.com/2013/01/26/automating-sitecore-deployments-with-tfs-and-tds/ and https://jermdavis.wordpress.com/2016/08/22/sitecore-builds-with-visual-studio-online-part-2-building-code-and-running-tests/
But the first article was written like 5 years ago and things have changed in deploy process from then and second article deals with a different problem than my need to set up the TFS build deployment with Sitecore content. I was able to set up the automated deployment finally and so i am writing this article, so this can be helpful for those who are looking for starting a deployment process using TFS build server (On Prem not cloud) from scratch.
Note – This blog is written by using Sitecore 9.0, SitecorePackageDeployer_v1.10, Visual studio 2017 build server. Other versions of Sitecore and TFS build servers may have different approach of deployments.
First, we have set up a TDS project in Visual studio which contains all the TDS templates, items.
Provide the Sitecore assembly path to ‘..\Library’ which contains the 4 libraries in the above error.
Navigate to Deploy tab of TDS project properties in Visual studio and make sure to check ‘Publish After Deploy’. This step will publish the site after deployment is done.
Follow the steps below to perform the build and release.
- Download the Hhogdev.SitecorePackageDeployer_v1.10.update from https://github.com/HedgehogDevelopment/SitecorePackageDeployer/releases
- Copy the package to C:\inetpub\wwwroot\Siteintsnace\sitecore\admin\Packages and install it via http://url/sitecore/admin/UpdateInstallationWizard.aspx?page=1
When adding v1.10, I got the error ‘This Sitecore installation cannot be used for either testing or production purposes until Sitecore support is contacted. Make sure to download and include the file containing diagnostic information about your Sitecore installation.’System.UnauthorizedException.
To resolve the error,
Navigate to /(Site root)/temp and give full control to Users
- Now, rerun the update package on dev environment and it should install successfully. Make sure the installation of update package is successful by verifying existence of physical path C:\inetpub\wwwroot\localhost \App_Data\SitecorePackageDeployer
- Enable sharing on the Package deployer (SitecorePackageDeployer) folder created above.
- Add Publish Build Artifact build configuration step to transfer the Sitecore items to SitecorePackageDeployer
- Populate the following values in publish build artifact of TFS build server.
- Make sure SitecoreContentBuildDropLocation folder is shared so we can access it using network sharing options (MSBuild).
- Build the configuration so it adds the Sitecore package to the local (build server) SitecoreContentBuildDropLocation folder.
- Now, create a release step so it will release the Sitecore update package to the corresponding dev environment “C:\inetpub\wwwroot\localhost \App_Data\SitecorePackageDeployer” folder.
- Add Window Machine File copy task in Release tasks.
- Select the TDS Sitecore Content folder as it contains the Sitecore package
- See the following screen to set up new task in release.
- Run the release from TFS build server and the Sitecore package should be added to the \SitecorePackageDeployer folder and it will be automatically uploaded on to the Sitecore instance.