Quantcast
Viewing all articles
Browse latest Browse all 3

Sitecore MVC quick start

Hello friends there are so many articles already written on this topic But I would like to put all this in one single post.

Today we will see below three points:

  1. How to enable Sitecore MVC while installing Sitecore setup
  2. How to configure Sitecore with ASP.NET solution
  3. At the last we will see one small example

If you are new to Sitecore technology and would like to know more about Sitecore CMS Version History then I suggest you to refer Kiran Patil’s blog on Sitecore CMS Version History.

So let’s start to setup Sitecore MVC, here in example we will use Sitecore 7.0. Try to setup new instance of Sitecore and when you see below screen capture just wait and click on “Advanced” button.

Image may be NSFW.
Clik here to view.
Sitecore Setup1

Once you click on “Advanced” button you will see below screen capture.

Image may be NSFW.
Clik here to view.
Sitecore Setup2

By default Sitecore MVC is enabled. So make sure if you would like to disable Sitecore MVC integration uncheck it.

You will not find above option in Sitecore 7.1 and above versions because Sitecore by default enable MVC integration.

Just a note:

Friends you may come across some issues while installing Sitecore instance. I would suggest you to refer Sitecore Corrupted Instance Manual Uninstall article written by Vasiliy Fomichev.

After doing successful setup please check your Sitecore instance is up and running.

Note: Please check your Application Pool Identity. By default it is set to “ApplicationPoolIdentity”, change it to “NetworkingService”. You must have question why? Your answer is here.

Friends our half journey done. Now let’s move to over next step which is how to integrate Sitecore with ASP.NET solution. Here we are going to separate Sitecore from Visual Studio Projects.

It is always good practice to separate Sitecore from Visual Studio Projects setup. You must have question why and what are the benefits of doing this? Please refer Visual Studio Projects and Sitecore post written by Sean Kearney.

Let’s go step by step:

  1. Create new ASP.NET MVC 3 application or create on solution file and then add new Project files. Refer below screen capture for the same.

Image may be NSFW.
Clik here to view.
Sitecore MVC Project Setup1

2.  One more thing, create one “_bin references” folder in your solution setup directory and copy DLLs related to Sitecore or Third-Party in it. There are some benefits of doing this – Best Answer. See below screen capture for the same.

Image may be NSFW.
Clik here to view.
Sitecore MVC Project Setup2

3.  Add references of below DLLs and make sure you set Local Copy = False as suggested by John West.

  • Sitecore.Kernel.dll
  • Sitecore.Mvc.dll
  • Sitecore.Logging.dll

4.  Remove Global.asax.* and Web.config.* files from your solution.

5.  Copy Global.asax and Web.config files from your Sitecore directory to your solution and include this files in your solution.

6.  Copy \App_Config\ folder from your Sitecore directory to your solution ignore \App_Config\Prefetch\ and \App_Config\Security\ folders, and make sure all copied folders/files are included in your solution.

7.  That’s it, all done. Just try to build your solution.

Now our last point is to create one simple layout. Refer below screen capture for the same.

Image may be NSFW.
Clik here to view.
Sitecore MVC Project Setup3

Now you must be thinking how we can deploy solution assemblies to Sitecore folder. There are two ways to do it.

  1. Post build configuration
  2. Publish option

We are doing it through second option. You can configure it either way. Make sure you are done with any of the above option.
We are done from solution side. Let’s move to Sitecore content editor and try to create one demo item and set its presentation details as shown in below screen captures.

Image may be NSFW.
Clik here to view.
Sitecore MVC Project Setup4

Image may be NSFW.
Clik here to view.
Sitecore MVC Project Setup5

That’s it. Try to see the preview of demo item. Below is the screen capture for the same.

Image may be NSFW.
Clik here to view.
Sitecore MVC Project Setup6

Good reads:

Sitecore MVC- Getting Started

Sitecore MVC – View Renderings, @Html.Sitecore(), and Custom Models

Hope you enjoy this. Please feel free to give suggestions.

Thanks to my colleague Kiran Patil for reviewing my first post.


Viewing all articles
Browse latest Browse all 3

Trending Articles