By Sitecore website root I mean the SIM-installed site at
Or should the Visual Studio solution, and thus source control base, be OUTSIDE/separate from the Sitecore website root? like
Sitecore Stack Exchange is a question and answer site for developers and end users of the Sitecore CMS and multichannel marketing software. It only takes a minute to sign up.Sign up to join this community
You always want to put your visual studio solution outside of the website and deploy into it.
Unless you are going to add 10,000 files to your gitignore file, you are going to have the base Sitecore files in your solution. When you upgrade your website, you are certainly going to miss some files. Then you will overwrite your upgraded Sitecore files with the old files in your solution. This will cause many strange behaviors and lots of errors about not being able to find classes.
The first major reason is that you cannot use Helix principles if you are in the website folder. Having a solution in the website folder restricts you to only one web project and many libraries. Using the Helix guidelines, you are going to need many web application projects.
Your visual studio project should be designed for each environment that you are going to need to deploy into. This means that if you are going to use gulp or msdeploy to deploy into prod/stage, you need to be able to test it in dev. Having a solution in the website, would not alert you to what files, dlls, etc.. that you are missing or not deploying properly.
By having your solution in the website folder, then you are most likely going to use the dlls in the bin as your reference dlls. But you should 100% use the dlls from NuGet. This allows you to build and deploy to environments without having 200 MB of dlls in your source control.
Yes, you can create the Visual Studio project inside the webroot of a Sitecore install. But It is not a recommended practice.
Things to consider for Visual Studio project inside the webroot-
Creating the project outside the webroot has a number of advantages and is a recommended practice: