Integrating Visual Studio solution and Sitecore instance

In this blog, lets create new Visual Studio solution and integrate it with the existing instance (http://learningsitecore/sitecore). We will create a simple Visual Studio solution. This will not be based on Helix principle so in case developers who know Helix principle are going through the blog then don’t get it wrong. We will learn Helix principles once we become comfortable with the basics.

  1. Go to Visual Studio and run it in an administrator mode. I am using Visual Studio 2017 so some options may be different for the ones who are using VS 2015. 
  2. Create new project and name it has “LearningSitecore” and select the Framework as .Net Framework 4.6.1. In case you don’t have option to select the framework then don’t panic, I will cover it in following steps.
  3. If the “Add to Source Control” is checked then uncheck it and click OK.
  4. Click on Empty and select MVC check box & click OK.
  5. The solution will look like below:
  6. Now in case if you didn’t have a option to choose the framework version then right click on LearningSitecore and Click on Properties.
  7. You can select .Net Framework 4.6.1 in the Target Framework and Save it.
  8. Now we will change the properties for Web.config, packages.config and Views/Web.config
  9. Change the Build Action to None for Web.config.
  10. Change the Build Action to None for packages.config
  11. Change the Build Action to None for Views/Web.config
  12. Now lets delete the folder which are not required. Delete App_Data and App_Start.
  13. Now lets take a backup of the website folder. Just to be sure that if something goes wrong we can quickly rollback. Copy and paste the website folder (C:\inetpub\wwwroot\LearningSitecore) and Name it as Website_backup. This operation will take couple of minutes to complete.
  14. Now lets switch back to Visual Studio and create a publish profile.
  15. Right click on Learning Sitecore and Click on Publish
  16. Click on Folder and select the path of Website folder.
  17. Click on Advanced.. link.
  18. Change the Configuration from Release to Debug. Since this is a local setup we might need to use a debugger in future so lets use a debug mode to publish.
  19. Click on Save and then click on Publish.
  20. You will get one build error regarding Route.config, this is because we have deleted the folder App_Start. So you can comment that one line.
  21. Save and Publish the solution. Right click on LearningSitecore and click on Publish.
  22. You will get below screen. Click on Publish
  23. Once the publish is complete, you will find the below screen.
  24. Now we are done with publishing, which means we have completed the integration. So its a time to verify if both (Sitecore(CM) and Front end(CD) sites are working fine).
  25. So browse both the URLs CM – http://learningsitecore/sitecore and CD – http://learningsitecore in different browsers.
  26. Since we have just published the solution, the sites will take time to load.

This completes our integration of Visual Studio solution with Sitecore instance. Now whoever were using Visual Studio 2015 should see both the sites loading but whoever is using Visual Studio 2017 like me will see an error page related to the version on System.Web.Mvc.dll. Lets resolve it in our next blog.

Thank you.. Keep Learning.. Keep Sitecoring.. 🙂


5 thoughts on “Integrating Visual Studio solution and Sitecore instance

  1. Pingback: Editing the existing page | Sitecore Dairies

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s