Unicorn for Sitecore and Version Control First Time Setup

After I got #Unicorn for #Sitecore setup for the first time I noticed the folders and yml files were created in my sites data folder. I want those files as part of my project and source controlled similar to TDS. So doing some research I found this setting in the Unicorn.config folder.

<targetDataStore
physicalRootPath=$(dataFolder)\Unicorn\$(configurationName)
useDataCache=false
type=Rainbow.Storage.SerializationFileSystemDataStore, Rainbow
singleInstance=true/>

I changed to my local folder in my project. I created two new folders under App_Data (Unicorn\Serialization).

<targetDataStore
physicalRootPath=C:\Projects\SitecoreTestSite\src\WebApplication1\WebApplication1\App_Data\Unicorn\Serilization
useDataCache=false
type=Rainbow.Storage.SerializationFileSystemDataStore, Rainbow
singleInstance=true/>

*Please note there is a Unicorn.CustomSerializationFolder.config.example that you can also change this setting in. Just remove the .example to use it.

When I went to [site]/unicorn.aspx I received the following error. If you receive this error either change the path to a smaller length or in my case I changed the value in App_Config\Include\Rainbow.config.

I changed this line:

<setting name=”Rainbow.SFS.SerializationFolderPathMaxLength” value=”103″ />

To

<setting name=”Rainbow.SFS.SerializationFolderPathMaxLength” value=”105″ />

Now after going back in to the Unicorn Control Panel I was able run an Initial Serialization. I had to do this since the folder path changed.

Then Sync Selected.

SitecoreTestSite sync complete: 1767 items evaluated, 0 items modified (0 added, 0 updated, 0 recycled) in 6331ms (~3.6ms/item).

Now back in my solution I show hidden files and folders and there are my files. I can then include them in my project.


So now you can make the files part of any source control sytem you are using. It is worth mentioning that there are other methods you can use like Sitecore Courier and Sitecore Ship. Also since projects are sometimes setup different locally for developers using something like slowcheetah might be a good idea to have your own development configuration for the Unicorn.config and Rainbow.config.

Update. In your publish settings I recommend checking the box that says Exclude files from the App_Data folder. You probably don’t want to publish those files.

localdeploy

Now I need to figure out how to sync someone else’s changes. I suspect it might be using the Publish Unicorn and Replace Unicorn from Server options.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s