Question

I want to set multi site setup in Visual studio for multiple sites in Sitecore. I want to have separate Layouts/sublayouts/ascx and code behind for all websites. Also i want separate config files for each website so that it will be easy to update individual sites. i didn't find any appropriate documentation from web.

Any help

Was it helpful?

Solution

This is what I do as far as Sitecore and Visual Studio structure goes:

1) Create sub folders for your sites in Sitecore within the Content, Layouts, Templates and Media Library folders.

enter image description here

2) Create sub folders in your web root on disk. Do this for the Layouts/View folder, but also for the client-side includes (css/js).
So you will get a structure like this:

enter image description here

3) Create a separate web application project for each site and place the .csproj file inside the web root.
Then include the necessary folders per project (so the Include/Site1, Views/Site1 folder are included in the project for Site1, etc).

enter image description here

4) Configuration is a little tricky, because you will always share one Sitecore configuration with all the site instances.
But what I do for settings is prefix them with the site name, like this:

<setting name="Site1.MySetting" value="MyValue" />

You can then put that in separate config files in the /App_Config/Include folder.
That will give you at least some separation of configuration per site.

I would create at least one sub folder within the Include folder to ensure your custom configuration is included as last.

5) I will usually also add one "site" project called Global that contains everything that is shared between the instances.
That will mainly contain templates in Sitecore and in the VS project it contains references to /sitecore files, global.asax, web.config and App_Config files.

There are of course many more factors to account for, but these are the basics for setting up the solution.

OTHER TIPS

I think this should be the documentation you are looking for:

http://sdn.sitecore.net/Articles/Administration/Configuring%20Multiple%20Sites.aspx

Here is a great blog I've read:

http://www.sitecore.net/Community/Best-Practice-Blogs/Topics/Multisite-Management.aspx

I have multiple solution files set up for multiple sites.
A suggestion would be to also move the App_Config, web.config, and bin libraries into the solution helps.
Setting up Sitecore Rocks will also be a great asset.

Edit: More Info

Hedgehog development has an amazing plugin for Sitecore as well called Team Development for Sitecore (TDS). You can check it out here.

I point my solution at: \inetpub\wwwroot\sitecore\Website

At the root of my solution:

  1. App_Config folder which holds my connection string configs and Lucene configs.
  2. Libraries folder which holds my application specific dlls.
  3. Sites folder which holds the sites and all the respective sublayouts. Sites contains multiple websites which all contain at a minimum of css, Images, layouts, Services, Scripts, and Sublayouts.
  4. The server's web.config with web.debug and web.release.

All of this is checked into Team Foundation Server with build servers and more.

For the layouts and sublayouts you can separate them like Rudd van Failer showed us above in VS, using directories named like your site (and point the layouts/sublayouts in sitecore to the appropriate places). i.e. sublayout file

For configuring your sites in VS, add all your site configurations to the SiteDefinition.config (or setup separate projects that contain their own SiteDefinition.config pointing each site to the appropriate sitecore location). i.e.

<sites>
    <site name="site1" patch:before="site[@name='website']" virtualFolder="/" physicalFolder="/" rootPath="/sitecore/content/" startItem="/site1/home page" />
    <site name="site2" patch:before="site[@name='website']" virtualFolder="/" physicalFolder="/" rootPath="/sitecore/content/" startItem="/site2/home page" />
</sites>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top