I have been working for some time with sitecore.
Since my arrival, I have been taking the existing projects as a reference and creating new projects.
For Sitecore, we will have loads of folders and files for the website. We only need to create sublayouts (*.ascx) together with JavaScripts and CSS files.
For those *.ascx files, I put them under layouts/Project_Name/The_File_Name.ascx and layouts/Project_Name/The_File_Name.ascx.cs.
In a *.ascx file, I have the following.
<%@ Control Language="c#" AutoEventWireup="true" TargetSchema="http://schemas.microsoft.com/intellisense/ie5" Inherits="Layouts.The_File_Name.The_File_NameSublayout" CodeFile="~/layouts/Project_Name/The_File_Name.ascx.cs" %>
After finishing, I deploy the whole layout folder onto the production server.
I will create a blank website on the production server and copy over the necessary files, mainly JavaScripts, CSS and *.ascx files.
Yesterday, A Sitecore consultant suggested that I change from CodeFile to CodeBehind and compile them.
I understand that if we create web application in Visual Studio, the system gives us CodeBehind and whenever we change, we need to compile.
But if we create a web site, we don’t need to compile. We can however, publish the site.
My question is: what did the consultant mean? Do I need to compile the whole Sitecore website folder?
If so, can I compile (build) the whole folder?
And can I get the *.dll from it?
So far, i have tried to compile 2 of my sites and I am getting this error
Could not load assembly or file ChilkaDotNet2 or one of its dependencies
I agree with the consultant. There are two project types in Visual Studio:
Sitecore itself comes shipped as a compiled web app, so for you to add layouts, sublayouts and anything else into it, you should create a Web Application Project (WAP) in VS and only include your files in the project. When you do this, you then just need to deploy your project’s
*.dll‘s to the target server’s/bin/and any*.aspxor*.ascxfiles (no code behinds or designer files).Now, in theory, you can create a WAP in VS and manually change
CodeBehindtoCodeFilebut then you need to deploy the*csfiles. In general, its recommend to use a web app so you can use automation processes like a build server or batch script to build your project.The error message you posted is because you’re trying to build the Website Project. A standard non-Sitecore Website Project can be built, but not if its Sitecore since Sitecore itself already exists as a compiled WAP and you cannot exclude files from the project from being built.
Here is a blog post by the CTO of Sitecore that may help you: Create a Visual Studio 2010 Project for a Sitecore Solution