My dear friends,
There are so many developers joining the Sitecore community and the first question that they have is how do I get set up my Sitecore Application, and get started. I got more than 20 requests on my email and Twitter, to help do so. I thought, why not write a blog with all the required basic details that helps everyone. So here it goes!
Developers who are getting started, have two main goals:
- Understanding Sitecore CMS (understanding Sitecore structure, creating templates, items, layouts and sublayouts)
- Implementing Custom Business Logic in a Sitecore Application (Backend Code)
Lets divide the complete process of getting started into 3 steps.
Step-1: Install a Sitecore Instance
There are 3 ways of doing this:
- Install using an executable available from the download section – Sitecore CMS
- Install using a zip file again, available from the download section – Sitecore CMS . (We might require some installation steps, and hence we can refer to installation guide available in Documentation Section.)
- Install a Sitecore instance using Sitecore Instance Manager(SIM). It is a standalone application, which we can use to manage multiple instances in our IIS. The link to the document explains everything necessary to configure SIM, Installing a Sitecore application, and installing required Modules if any (say we want to install DMS, or say we want an MVC enabled Sitecore application)
For simplicity, in my local box, I have configured SIM as follows:
Instances Root Folder: C:\Varun\My-Setup-Sitecore-Instances
Local Repository: C:\Varun\Sitecore-Plain-Instance-Repository
With that, our Step 1 is over with this.
Now, the choice is yours.
If we are to start understanding the basic architecture of Sitecore, we can pause for now, create a few templates and items, layouts and sublayouts, and get some basics clear and then come back and continue with Step 2 and 3.
A couple of useful links that I found for the same:
- Sitecore 5 Basic Simple Steps Creating First Website
- Sitecore Self-Study Building a Very Simple Website
Step-2 Create a Visual Studio Project
As a Dotnet developer, we all know how to create a new Visual Studio Project, so there is nothing to explain here.
Based on our requirement, or based on what we want to have hands-on, we will create a Visual Studio Web project, either a WebForms Project or an MVC Project. (Make sure that if you have installed MVC module while installing Sitecore using SIM, select MVC project, otherwise select WebForms Project)
Next, we need to do a set of steps over here:
- Delete the web.config and global.asax from the project.
- Add a new folder, call it Libraries and add Sitecore.Kernel, Sitecore.Client and Sitecore.MVC (if you have created MVC Project) and any other DLLs or third party libraries you want to use in this folder.
- Reference them in your web project.
- Add the Web.Config, App_Config and Global.asax from your Sitecore solution to this project
- Build the solution once.
In my local box, I have configured a Folder, where I create all the Visual Studio Projects as follows:
Visual Studio Projects: C:\Varun\My-Projects
Step-3 Deploy Visual Studio Project code to Sitecore Instance
We can do this, by creating a publish profile for our project.
Many Dotnet developers might know this, but still I would like to go in a little detail for this.
Once the step 2 is over,
- Go to Build -> Publish [ProjectName] Or Right-click on the Web Project and click on Publish Option.
- A Publish Web dialog opens as follows:
- Click on the <New Profile>
- Give a suitable profile Name. (Generally, we should create multiple profiles and name them as per our environments, like say LocalDeploy, SandboxDeploy, StageDeploy and ProdDeploy. But still, for understanding and trial purpose, any name would do.)
- Next, in the Connection horizontal tab, select FileSystem to be your Publish Method, Select Local IIS in Target Location and select your Sitecore Solution (the one that you created in Step-1) to be connected.
- In Settings, lets select Debug Configuration for LocalDeploy, while for other profiles, we need to select Release. Also, we should make sure that we don’t select any other File Publish Options.
- Click Publish, and it will build the Project and send all other required files to the Sitecore Solution folder.
Also, for simplicity, we can go to the right-click in the toolbar above, and select Web One Click Publish and this small tool appears, which is very easy to use!
With that, we have setup our Sitecore Instance, Created a Visual Studio project and then connected it with our Sitecore Solution.
There are a number of advantages of having this type of architecture in our Sitecore Solutions.
- Sitecore upgrades become easy.
- If our Sitecore solution is down, its easy to identify where the issue is, whether its the Sitecore Application with some wrong configuration or our Custom Code from the Visual Studio Project.
- Again, if our Sitecore solution is down, instead of spending a lot of time getting it up, create a new Sitecore Instance, create a new Publish Profile and Publish your project changes.
So, from now on, lets make it a point to host our Sitecore Solutions in this way which is quite loosely-coupled and maintainable and easily manageable.