Create a Visual Studio 2010 Project for a Sitecore Solution

This blog post describes how to create a Visual Studio 2010 project and solution for an installation of the Sitecore ASP.NET Web CMS. The Presentation Component Reference on the Sitecore Developer Network contains the same instructions for Visual Studio 2008 and 2005.

Update 1.October.2010: Definitely read the comments on this blog, Sean's blog, and the comments on Sean's blog.

In Visual Studio 2010, to create a project and solution for a Sitecore installation:

  1. Click File, then click new, then click Project. The New Project dialog appears.
  2. In the New Project dialog, select .NET Framework 4, select the ASP.NET Empty Web Application project model, set Name to the name of the project (ProjectName), set Location to the path to the WebSite folder for the project (C:\inetpub\wwwroot\ProjectName\WebSite), clear the Create directory for solution checkbox, and then click OK.
  3. In Visual Studio, click File, and then click Close Solution.
  4. Move the Properties folder, the .csproj file, and the .csproj.user file from the subdirectory created by Visual Studio (C:\inetpub\wwwroot\ProjectName\Website\ProjectName) to the WebSite subdirectory (C:\inetpub\wwwroot\ProjectName\Website). Then delete the subdirectory created by Visual Studio (C:\inetpub\wwwroot\ProjectName\Website\ProjectName).
  5. In Visual Studio, open the .csproj file.
  6. In Visual Studio, in Solution Explorer, delete the /Web.config/Web.Debug.config and the /Web.config/Web.Release.config file from the project.
  7. In Visual Studio, in Solution Explorer, add references to /bin/Sitecore.Client.dll, /bin/Sitecore.Kernel.dll, and any other existing assemblies that you use in every project. Remember to set the Copy Local property to false for each reference to an assembly in the /bin folder.
  8. In Visual Studio, in Solution Explorer, double-click Properties, enter a default Assembly name and a Default namespace, and select the appropriate .NET framework version for your version of Sitecore.
  9. Update 1.October.2010: In Visual Studio, in Solution Explorer, remove any broken references for the project, such as Microsoft.CSharp. 
  10. Update 1.October.2010: If you use the /layouts subdirectory and/or the /xsl subdirectory, in Visual Studio, in Solution Explorer, select the project, and then click the Show All Files button. Right-click on each relevant subdirectory and then click Include In Project, then right-click each of the individual subdirectories and files in that subdirecetory and click Exclude From Project. Remember to clear the Show All Files button afterwards, or debugging from Visual Studio could fail.

At some point (such as when you build), Visual Studio will prompt you to create a solution for the project.

Update 1.October.2010: You might also want to read another post in on this blog, Simplify Visual Studio Project Creation.

  • Ehh select .NET Framework 4? From which Sitecore version is this supported?

  • John, I argue that this isn't the "best" way to work. My post is too long for a comment so I made a blog post out of it.

  • Per: I think Sitecore 6.4 will support .NET 4. I suggest selecting .NET 4 because for me, the Empty ASP.NET Web Application project doesn't seem to exist for other versions, so I would have to use ASP.NET Web Application for those versions instead. If I select .NET 2.0, I have to remove /Scripts and /Default.aspx from the project, and if I select .NET 3.5, I also have to remove /Account, /Style, /About.aspx, /Default.aspx, /Global.asax, and /Site.Master. I noted that you have to update the framework version for the project afterwards. I had neglected to mention that this approach requires you to remove the Microsoft.CSharp reference after you change the .NET version.  Sean: I commented on your blog. It sounds like you use the same project model and most of the same instructions, but just keep the code elsewhere?

  • John, yes the main issue I have is where the project/solution should reside. The steps you outline for creating the solution/project are sound. Sorry for the confusion.

  • when I run default.aspx from VStudio (using integrated server port), I get Exception Details: System.Security.Cryptography.CryptographicException: The parameter is incorrect.  What could be the issue?

  • You would normally attach to the ASP.NET worker process instead of debugging a specific default.aspx. See how to debug here and post again if you still have the same issue: Component Cookbook.aspx  

  • I followed these instructions and I have my VS project built. I can access SiteCore in Desktop mode but if I want to preview or I want to access in Page Edit mode I get a 403 error. Could it be that Visual Studio has changed permissions to the website files?    

  • @Fer Fer: I have never seen anything like that, but I suppose it is possible. You might get this type of result for configuration or other types of issues that you might not recognize as 403 conditions, such as a corrupt cookie, session, browser cache entry or browser configuration, etc. See  These applications worked before you attempted to debug? Had they worked after you last compiled? Did you make any other change to the configuration after installation? Did you use the setup.exe, or .zip? Install any modules? I would suggest posting here, and including these and any other relevant details:

  • @John: Thanks for your feedback. It was actually my mistake. Some how I deleted default.aspx. Luckily I could restore it from the recycle bin.  I am all set!!

  • For the Exception Details: System.Security.Cryptography.CryptographicException: To fix this right click on project and set Target Framework to .NET 3.5

  • Hi John, Is it necessary to keep sitecore  website folder and project folder in same directory. Can we keep 2 things  in different drive, i.e when sitecore install we will  install in c drive and when create visual studio project in d Drive ? If Yes then How can we do ?. and  Is it necessary to keep same name both(sitecore folder name as well as project name). If No,  how we map 2 or 3 project in one sitecore instance ?

  • @Mrutyunjaya: I think you can create the project in any directory. The name of the directory that contains the project does not matter, but the directory structure within that project (/bin, /layouts, /xsl, etc.) should match that within the Sitecore installation subdirectory (/Website) - see I don't think there is anything Sitecore-specific to worry about here, but you need to ensure that you copy the files (.dll, .aspx, .ascx, .xslt, .css, .js, etc.) from your project to the document root. There is a syntax to automate this operation with Visual Studio project files (Chapter 8 of has one example), but you could also use

  • Hi John , Thank you for your reply.     Sitecore website folder(sitecore installation)  is on remote server. How can I connect   from sitecore website to my local Project without  using TDS.How does RemoteSitecore point to my only specific sitecore project. Is there any specific instance we have to attach ?.  I have sitecore ECommerce1 and Ecommerce2 Project on my local server. While I am working on Ecommerce2 , How does common sitecore website(from Remote server) connect to My Ecommerce2.  Thank you  

  • @Mrutyunjaya: Sorry, that is beyond my knowledge of Visual Studio and IIS. I always run Sitecore locally. Unless I misunderstand, I would try to research this as an IIS/Visual Studio issue rather than as something specific to SItecore. But I would first try to run Sitecore locally, and I would definitely consider TDS.

  • I have come to completely agree with Sean that the advantages of keeping the project outside of the document root outweigh the advantages of keeping it within the document root. I use a solution like this to copy files from my projects (which I could store anywhere, but store in c:\inetpub\sitecore\projects) to the IIS instances (which I store under c:\inetpub\sitecore) after building: