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.

VS-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.

VS-inside-webroot-MVC-project

  • 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.

VS-MVC-project

  • Once the project is created, solution contains the files as shown below.

VS-solution-explorer

  • Now from the project, remove Web.config, and Global.asax files, otherwise while publishing, these files will override the respective Sitecore files.

VS-inside-webroot-file-delete

  • Once after deleted, we need to copy both Web.config and Global.asax from web root into the project.

VS-inside-webroot-file-paste

  • Create a folder with name App_Config, then copy the ConnectionStrings.config & Sitecore.config files from web root to the project.

VS-inside-webroot-config files

VS-inside-webroot-config files-copy

  • 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.

VS-inside-webroot-dll

VS-inside-webroot-dll-copy-1

VS-inside-webroot-dll-copy-2

VS-inside-webroot-dll-reference

  • 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.

VS-mvc-version

  • 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.

VS-publish-profile

VS-publish-profile-2

VS-publish-profile-3

  • At last, click on the Publish button, we can see the Site is published to web root folder.

VS-publish-profile-4

  • 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.

VS-publish-verification

  • Now try to load the site, and check whether we are able to login to Sitecore or not.

VS-deploy-verify-1

VS-deploy-verify-2

That’s all, thanks for reading.

Happy Learning 🙂