In recent post we had seen, how to set up project inside the web root. But this option is only useful for POC’s. Most of the time outside web root option is more useful. In this post let’s explore more advanced,
I am using Visual Studio 2015 community/professional edition, and Sitecore 8.2.
Outside web root setup steps:
- Open the Visual Studio, and navigate to File -> New -> Project, to create new project.
- Select the .NET Framework (in our case 4.5.2) version, and select the ASP.NET web application template.
- Enter the Name of the project, specify the Location field, and then click on OK to continue.
- Now we get another dialog, to select the project template. Here select Empty template present under ASP.NET 4.5.2 Templates section, and check the MVC checkbox as shown below, and click OK to proceed.
- Once the project is created, solution contains the files as shown below.
- Now from the project, remove Web.config, and Global.asax files, otherwise while publishing, these files will override the respective Sitecore files.
- Once after deleted, we need to copy both Web.config and Global.asax from web root into the project.
- Create a folder with name App_Config, then copy the ConnectionStrings.config & Sitecore.config files from web root to the project.
- Next step is to add Sitecore references. We need both Sitecore.Kernel.dll & Sitecore.MVC.dll, Let’s grab these files from web root. Create a directory in Project file system, let’s call that Assemblies, and copy the two dll’s to inside the directory.
- Please double check on the Mvc version compatibility here, and make sure you are using correct .NET Mvc version. We can verify the MVC version in Web.config file as shown below.
- Now our project is all set. To deploy we need to create a publishing profile. Select Publishing Method as File System and specify the local Sitecore instance web root path.
- At last, click on the Publish button, we can see the Site is published to web root folder.
- To confirm the publish to web root folder, we can navigate to bin folder in web root folder, and see that SIMSitecore.dll is copied over.
- Now try to load the site, and check whether we are able to login to Sitecore or not.
That’s all, thanks for reading.
Happy Learning 🙂