Sitecore solution best practices

- Pranay on Mai 03 '16
- 1905 views

This post highlights the best practices to be followed for the visual studio sitecore solution which is used with Sitecore website folder. If you are looking for integration of a new visual studio solution with Sitecore then this post might help you - Integrating Visual Studio solution with Sitecore MVC - basic

Sitecore solution best practices

  1. It is always recommended to work outside the web root folder though we are allowed to work inside the web root.

    • This makes the clear separation of your solution files from the Sitecore files.
    • Easily maintain different environment configuration files
    • You can deploy the same solution code to multiple site ore instances.
    • this will also allow you to easily source control your solution.
    • Need not to maintain unnecessary artifacts inside the Website folder.
  2. When Sitecore is upgraded, it is required to update all the DLL references you are making in your visual studio project. Hence it is recommended to copy all the reference DLL to a library folder in the VS solution. If you are using a version control system, the Library folder will be updated with the upgraded DLLs and thus there wont be any conflicts. OR

    if you do not want the libraries folder to be version-controlled, then have a local nuget server and update your packages.

  3. Do not reference any DLLs from your local website folder.

  4. Do not edit the web.config file inside the Website folder. If you would like to make any changes, patch those changes to the files inside the App_Config/Includes folder. Web.config filde is a complex file, making any changes to it makes the Sitecore upgrade complex.

    You can view the complete patched config file from '/sitecore/admin/showconfig.aspx' or you also check from Sitecore Rocks by right clicking on Sitecore instance -> Tools ->Open Expanded web.config file

    Note: If you are looking for complete list of such admin pages then this post might help you - List of Sitecore admin pages

  5. Resuse data template by inheritance where ever necessary.

  6. Check if you really need to reference an item using ID/Path in code as both of this makes the code tightly coupled. Referring by ID makes the reference break if the item is recreated, as the item ID will change if the item is recreated. Referring by path makes the reference break if the item is moved or renamed. Instead you can use an item based on its template type

  7. It is recommended to create a separate website node structure in the content tree though you have a single website. Just to make it easy if you are adding a new website in future.

  8. Name the template names properly. As their names will be visible to the content author in the insert options. Assign different icons to different templates as it make the items identity easily using the icons.

  9. Make sure you not having same field names in the parent and child data templates. This would look as if the same field if coming twice and may make the content editor confuse.

Please comment you have any other points to be added. Thank you. Happy Sitecoring!!

About the author

Pranay Deegoju
Sitecore Certified Professional

A Software Engineer by profession, a part time blogger and an enthusiast programmer. You can find more about me here.



Leave your comments on this post here