ref – https://www.akshaysura.com/2016/06/29/tihidi-setup-a-visual-studio-2015-sitecore-8-x-mvc-solution/
Assuming you have a Sitecore site already set up with the Sitecore Instance Manager, you want to create a project in Visual studio so that you can start developing custom code for sitecore.
Initial Setup
First create a new folder on your desktop like so:
C:\Users\Ricky_Tsao\Desktop\Projects\TIHIDI
Then create folders Dependencies and Source like so:
C:\Users\Ricky_Tsao\Desktop\Projects\TIHIDI\Dependencies
C:\Users\Ricky_Tsao\Desktop\Projects\TIHIDI\Source
Source folder is where you’ll put your Visual Studios project.
Then create folder Sitecore under Dependencies like so:
C:\Users\Ricky_Tsao\Desktop\Projects\TIHIDI\Dependencies\Sitecore
Creating VS project
Start the VS as an admin. Go to File > New > Project. Under New Project, click on Web, then new ASP.NET project.
Give it a name, say THIHIDI.WEB. Then under location, Browse to:
C:\Users\Ricky_Tsao\Desktop\Projects\TIHIDI\Source
This is where you will be putting all the project files. Uncheck create directory for solution. This is because the Source folder is already the directory for our solution.
Then on the next screen, we’ll select the Empty project, check the “MVC” box, and click OK.
Settings
When the project is up, Delete the Web.config and Global.asax.
What we’re gunna do is to get the web.config and global.asax from the installed sitecore site, and copy it into our visual studio project.
copy global.asax and config.web from:
C:\inetpub\wwwroot\hadoken\Website
into
C:\Users\Ricky_Tsao\Desktop\Projects\TIHIDI\Source\TIHIDI.Web\
App Config
Create App_Config folder in C:\Users\Ricky_Tsao\Desktop\Projects\TIHIDI\Source\TIHIDI.Web\
Copy the ConnectionStrings.config and Sitecore.config from:
C:\inetpub\wwwroot\hadoken\Website\App_Config
in to your visual studio’s (Web project root) > App_Config folder:
C:\Users\Ricky_Tsao\Desktop\Projects\TIHIDI\Source\TIHIDI.Web\App_Config
Back in Visual Studio 2015, include the newly created App_Config folder. If you don’t see the App_Config folder, go to menu Project > Show All Files. Then you should be able to see the App_Config folder.
Also include the copied Global.asax and Web.config.
Add references to the Sitecore.Kernel.dll and Sitecore.Mvc.dll from
C:\Users\Ricky_Tsao\Desktop\Projects\TIHIDI\Dependencies\Sitecore
Open Views\web.config and add the following to the end of the
1 |
<add namespace=”Sitecore.Mvc” /> |
Restart Visual Studio 2015 and reopen the solution.
Rebuild solution.
At this point we have everything we need to deploy. Double check to make sure your MVC versions matchup before you deploy to the website. In my case, no additional work needed.
Setup a One Click Publish profile pointing to the website root.