Developing in Sitecore 7.5 — Solution Setup

In a previous post, I went over the steps required to setup Sitecore 7.5 (including installation of Sitecore itself and MongoDB for analytics). In this post, I will describe the steps involved in setting up a Visual Studio solution so you can begin working with your new installation.


First thing’s first, let’s setup our new web project. To do so, open your Visual Studio and create a new ASP.NET Web Application. I’ve named mine “Sitecore75.Web” and changed my solution name to simply “Sitecore75”.

NOTE: Previous practices stated this should be created in the web root alongside your Sitecore instance; That has since changed. It’s now a better practice to keep your project and Sitecore installation separated, for multiple reasons:

  • Separation of what’s live and what isn’t
    By keeping the source code in a different directly, at the end of the day we’re only publishing what’s necessary.
  • Easier source control tracking
    You only need to check in what you’ve created and not the dozens of assets Sitecore itself provides.
  • Re-hydrating made easier
    As you get into bigger projects, you’ll want an easy way to destroy a copy of sitecore and bring it back (think version upgrade, rolling out a new server or continuous integration)

11-1-2014 5-05-12 PM

Next you’ll be prompted for the project defaults. To keep things simple, let’s start off with an Empty web project, and no specific ASP technologies selected (such as Web forms, MVC or Web API).

NOTE: You can chose to include a unit test project at this point, but this is up to you. I find it a bit easier to do so through the project wizard, but that’s entirely up to you.

11-1-2014 5-10-01 PM

Once your new solution has been created, there a few things we need to do immediately. First, remove your web.config transform files for build configurations. These would include the web.release.config and web.debug.config files.

11-1-2014 5-10-46 PM

Next, go to the properties of your web.config and set the Build Action to None.

11-1-2014 5-11-56 PM

This is because we only need it while developing in Visual Studio (for things like scaffolding settings), but do not need (or want) it published to our Sitecore instance. Sitecore already comes with a web.config (with a lot of configurations baked in), so this just allows us to use the same project to target multiple Sitecore instances. Picture using this project to target future versions of Sitecore and not worrying about if we have the right Sitecore web.config in the project.

Moving on, we need to bring our Sitecore DLLs into the project. I like to create a folder within my solution named “sitecore”, then reference them from there. So, all I’ve done is opened the solution folder, created a new folder named “sitecore” and copied my Sitecore.Kernel.dll file from my installed instance’s \bin directory into this folder.

NOTE: Include the corresponding .xml file if you enjoy the comments provided with IntelliSense.

11-1-2014 5-12-30 PM

11-1-2014 5-13-33 PM

11-1-2014 5-57-52 PM

NOTE: If you’re looking to use Analytics you probably want to include Sitecore.Analytics.dll (this would also cover the VisitorIdentification tag). If you’re looking to develop in MVC, make sure to include Sitecore.Mvc.dll & Sitecore.Mvc.Analytics (and the appropriate version of the Microsoft.AspNet.Mvc libraries based on this KB article).

After we have the files squared away we’ll want to add them as a reference to our project. So, right click your References of your project and Add Reference. Chose browse, locate your copied dll(s), then include it in your project. (Make sure to repeat this process for your Tests project if you did create one).

11-1-2014 6-01-14 PM

11-1-2014 6-03-15 PM

11-1-2014 6-03-33 PM

Next, set the Copy Local property of the Sitecore dll(s) to false. We’re only including it in our project for reference’s sake (same reason we didn’t need the original Sitecore web.config).

11-1-2014 6-05-52 PM

To get the files to our Sitecore instance, let’s setup publishing. If you’re unfamiliar with this, I recommend reading up on One-Click Publishing. If you are familiar, or if you’re developing local like I am, feel free to follow along with my process:

11-1-2014 6-43-37 PM

11-1-2014 6-43-58 PM

11-1-2014 6-52-07 PM

11-1-2014 6-52-59 PM

11-1-2014 6-54-27 PM

11-1-2014 6-54-02 PM

That’s it. You’re now ready to begin developing (including creating layouts, renderings, etc.) and publishing to your Sitecore instance.

Interested in downloading this solution? Check out the GitHub project (this blog corresponds to release v1.0).

Series Posts

  1. Developing in Sitecore 7.5 — Setup and Installation
  2. Developing in Sitecore 7.5 — Solution Setup
  3. Developing in Sitecore 7.5 — Adding Sitecore Rocks

Flattr this!

Brad Christie

Software programmer from New Hampshire who enjoys the challenge and fulfillment of accomplishing any size task with ingenuity and persistence. I currently work at Sitecore as a Solutions Architect and an MVC evangelist.