views:

268

answers:

3

We're using Sitecore and to share the content between developers we're serialising the content tree to the filesystem then checking this into source control. This worked fine in the last project that used SVN, but this new project is using TFS.

Unfortunately TFS won't accept paths that have a dollar sign in them, ie

\serialization\master\sitecore\templates\Branches\Calendar\Agenda View Settings\$name.item

and this is a very common file name for Sitecore's serialisation structure. Is there any way around this? Can Sitecore be changed to not put the $ in front of the file names or do we have to switch to SVN?

A: 

Is the workaround suggested here (in the 'Community Content' at the bottom of the page) any use to you?

AakashM
That looks familiar :) It's not a great workaround, I admit; changing things on the SiteCore end would definitely be preferable.
Richard Berg
A: 

Hi Glenn,

I did some digging around. It's doable, however not immediately straight forward.

When serializing a tree, Sitecore invokes: Sitecore.Shell.Framework.Commands.Serialization.DumpTreeCommand. This is defined in /App_Config/Commands.config. When de-serializing, the equivalent .LoadTreeCommand is invoked.

What these commands do, is little more than invoking:

protected override void Dump(Item item)
{
    Sitecore.Data.Serialization.Manager.DumpTree(item);
}

And unfortunately, to get to the functionality you need to override, it looks like you are going to have to 1) override the command in commands.config, and then create your own Serialization Manager (inheriting from Sitecore's).

I'm not entirely sure how easy this would be, since most of the methods in this class are static members. The method you would need to override/re-implement is this one:

public static void DumpItem(string path, Item item)
{
    Assert.ArgumentNotNullOrEmpty(path, "path");
    Assert.ArgumentNotNull(item, "item");
    Directory.CreateDirectory(Path.GetDirectoryName(path));
    using (new SecurityDisabler())
    {
        TextWriter writer = new StreamWriter(File.Create(path));
        try
        {
            ItemSynchronization.WriteItem(item, writer);
        }
        catch
        {
        }
        writer.Close();
    }
}

The filename, as you can see, is based entirely on the Item's path. The assumption is, you could perhaps get away with something like .Replace("$", "!dollartoken!") and implement the reverse in your de-serializer.

Seems a lot of work though, unfortunately.

Mark Cassidy
A: 

Oh, and one more thing.

http://www.hhogdev.com/products/team-development-for-sitecore.aspx

I've not had the chance to test this tool myself yet, but it looks interesting and could potentially be the answer to your source control challenges.

Mark Cassidy