Setup Asp.Net MVC Project For Our Sitecore Instance
- Vignesh Amirthalingam
- Jul 16, 2023
- 2 min read
In this blog we are going to see how to setup Asp.Net MVC Project for our Sitecore instance in Visual Studio.
Before we start kindly up and run your Sitecore instance in your local machine.
If you like to learn how to setup your Sitecore instance, kindly refer the below link,
First we will discuss the prerequisite [Here I am going to setup a project for Sitecore 10.3 XP instance]
Visual Studio 2022
.Net Framework 4.8
Asp .Net MVC 5.2
Note: Prerequisite changes based on Sitecore version installed in your machine , For that refer the Sitecore compatibility table.
So once above things are done we are ready to setup the project .
Do the below steps first
Create the new project

Select blank solution

Provide the blank solution name and the path where you need your solution and create it

Once you create the solution, it will look like as in the below screen shoot.

Next right click the solution and add new project , for that do the below steps.
Select ASP.NET Web application(.Net Framework)

Next provide the project name, path, framework and create it .

Next select empty application and check the MVC under (add folders and core references).

Once project is created, it will look like as below screenshot in solution explore

Next delete the Global.aspx file under the project

Next right click "web.config" file and select the properties and then change the build action value from content to none [Note: Do the same step for "web.config" file under the views folder]

Next build the solution

Next we need to publish the project, before publishing do the below steps.
Right click the project and select publish, it will open the publish popup, there select the folder and click next

Next select the path where our Sitecore instance is located under "inetpub" folder and finish it

Once publish setup finished, it will look like as the below screenshot

Final step is to rename the profile name using more action button

Next add the package source , for that do the below steps,
Go to Tools--> Option--> Nuget Package manager--> package sources
In the name filed provide sitecore
In the source provide this link - https://sitecore.myget.org/F/sc-packages/api/v3/index.json

Next lets install the required Sitecore packages, for that right click the project and click Manage Nuget Package.
In the Nuget package manager install below mentioned packages
sitecore.kernal

sitecore.mvc

sitecore.mvc.analytics

Note: During package installation, set dependency behavior under install and update option as "ingore dependencie"
Next publish the project after all the above mentioned packages are installed

Now let's run our Sitecore instance, for me it ended up with below error.

The above error is due to version mismatch for "system.web.mvc". Downgrade the "microsoft.aspnet.mvc" version into 5.2.4.0 will resolve this issue.


Next publish the project.

Now run the Sitecore instance, oops again it ended up with below mentioned error.

So, now downgrade the "microsoft.web.infrastructure" to 1.0.0 version


After downgrade is completed, publish the project .

Now try to reach our Sitecore instance and site . Great it is up and running.


So we have successfully completed the project setup for our Sitecore instance.
Thanks!...
Any question leave your comments in the below comment section...
.