Creating Sitecore Solution

In this tutorial we will be creating a Visual Studio solution for creating your own Sitecore website.
There are a couple of ways to facilitate the creation of a Sitecore site. In this tutorial we’ll be using Web Deploy to deploy the binaries to an existing Sitecore site.

Prerequisites:

  • Microsoft Visual Studio
    I will be using 2013 Premium, but any other version above 2012 should work fine.
  • Sitecore
    Version should not matter, but I’ll be using Sitecore 8.0.

  • Internet Information Service (IIS) with Manager

  • SQL (Express) server

Before we can create the solution, we need a running Sitecore site.
You can do this by extracting the Sitecore zip and pointing a new IIS website to it, or by running the Sitecore installer.

Creating the solution

Now that we have a site running, we want to create a new web project in Visual Studio. Open your Visual Studio and create a new ASP.NET Web Application.
Give your Project and Solution a name. In this example I’ll be creating the MusicStore project solution, so I named the project “MusicStore.Web” and solution “MusicStore”.

Next you’ll be asked to select a project template. To keep this solution easy We’ll choose the “Empty” template. I did check the MVC option below the template select, so that the needed references and folders were already added for the site I was creating.

Now we have created a new solution. Though there are still some default settings added which we will have to remove.

First we should remove the created web.config transform files. If you expend the web.config file in the solution explorer, you’ll see a web.release.config and a web.debug.config file. Delete both of the files.

Next, go to the properties panel of the web.config file. Set the Build Action from Content to “None” and the Copy to Output Directory to “Copy if newer”.

Because Sitecore comes with a web.config, you’ll have to copy its contents to the web.config of your new project. Normally you should not do this, and only create new configs which would be included, but that’s too much work for this tutorial.
So we will just edit the location of the dataFolder in the web.config. Change it to the location of the Data folder which is placed where you installed/created the Sitecore site.

Now to get the files of the website to the Sitecore website root, we will use One-Click Publishing.
Right-click the project item in the solution explorer, and select “Publish…”

The publishing wizard will now open.

We want to use a Custom publishing target, so select that and enter a name for this publishing profile.

Next we need to specify a connection. We want to publish the site artifacts to the website root of our Sitecore site. Select “File System” as publish method and change the target location to you website root.

Next step is to select the publishing settings, not very exciting. Just select a configuration you want to build in and go to the next step. You should select a Debug configuration if you want to debug your site.

The last window of the wizard will show a preview of our selected options. In this case it doesn’t tell us all that much, just that we publish it to the website root folder.

If we now save the profile and start a publish, we’ll see that Visual Studio will build our solution and then publish the project.

Once you have created parts of the site, the publishing will copy over the binaries from the build and copy any content to the website root(like views, javascript and css files).

That’s all there is to it! We are now ready to start developing our site.

Leave a Reply

Your email address will not be published. Required fields are marked *