Saturday, March 23, 2019

CREATING A VISUAL STUDIO SOLUTION FOR SITECORE PROJECT



Here are the steps that help sitecore beginners on how to create a visual studio solution for their sitecore project.

1. Open Visual Studio as Administrator

2. Choose File -> New Project

3. In the dialog box, select ASP.NET Web Application

4. Select Empty template and check the MVC checkbox in Add Folders and core references section and click OK

5. Once the VS project is created, replace the global.asax file of newly created project with the global.asax file from the Website folder of sitecore instance.It will have only %@Application Language='C#' Inherits="Sitecore.Web.Application" %

6. Similarly replace the Web.config of VS solution with the Web.config file of the sitecore instance. This is done because once if we publish the project,the file in the project should not overwrite those within the sitecore instance.

7. Right-Click the References in VS solution, select Add Reference-and browse to the bin folder within website folder of sitecore instance. Select the following files:
Sitecore.Kernel
Sitecore.Mvc
Sitecore.Mvc.Analytics

8. For each of the above added references , right-click it and go to Properties.In that, set the Copy Local property to false

9. In VS project,go to Views/web.config file and add the following namespaces:
<add namespace="Sitecore.Mvc" />
<add namespace="Sitecore.Mvc.Presentation" />

10. Now, right-click near the toolbar of VS project and check the Web One Click Publish. In the Create Publish Setting dropdown, select <New Custom Profile> In the dialog box appeared choose File system. In the dropdown of target location, browse to the website folder of sitecore instance. Then click Publish.
Now MVC solution is created for the sitecore instance.

Thanks for reading.. Let's TRAVEL WITH SITECORE...

No comments:

Post a Comment