When using Team Development for Sitecore (TDS) you may need to tell your source control system how to handle certain files. This post is mainly targeted to folks using Git as their source control system, but it could be a general guideline for people using any source control system that isn't integrated with Visual Studio.

Excluding Certain Files

TDS creates a few files on your disk that shouldn't be included with source control. These files are typically user specific files and/or build generated files. Here is a list of files and directories (with a wildcard character) that should be ignored.

  • *.scproj.user
  • T4RenderCache/
  • IconCache/ 
  • BuiltFiles_*.txt
  • Package_*/
Also worth noting is that TDS is configured with configuration specific 'Build Output Paths.' This means that when you build your TDS project "Debug," "Release," "[custom config]" directories are created. If you only have 'Debug' and 'Release' then there shouldn't be much of a problem if you are using Git since GitHub's default .gitignore file will exclude them. However, any custom configuration build output directories may be picked up as an 'uncommitted change'. I recommend manually changing your TDS Build Output Path to be ".\bin\[Config Name]" rather than the default ".\[Config Name]" to prevent custom config build outputs from accidentally being checked into Git.
 
Change this:

 

To this:

After you change your build output path, here are some lines you should add to your .gitignore when using a TDS project:

#############
## Hedgehog Development's Team Development for Sitecore
#############
IconCache/
T4RenderCache/
BuiltFiles_*.txt

Handling Line Endings

The Sitecore Serialization Format is rather strict especially with line endings. There may be instances where you have a Rich Text field that was serialized to have a mix of CRLF and LF. If you are using the default GitHub .gitattributes file you can run into issues. To get around this you can modify your .gitattributes file with these lines: (thanks to Nick Wessleman for discovering this issue). 

 # Custom for TDS/Sitecore serialization 
*.item -text 

If you've already added .item files to your repo without setting the .gitattributes, you may see errors like this:

System.Exception: Failed to load version 1 for language en ---> 
System.Exception: Length of field content does not match the content-length attribute. Field name: xxxx, field id: {4B1DF5BC-C670-41DD-800E-F8079ECE09CA}

Comments (4) -

Kern Herskind Hansen

Kern Herskind Hansen 英国 says:

Great article!

With regards to Handling Line Endings. Did you not mean: "...this you can modify your .gitattributes file with these lines:"? (or is it same same)

Kam

I believe there's a typo at the end; one would add the "*.item -text" to the .gitattributes file, not .gitignore.

Sean

Kern and Kam,
Thanks. Yes, I had a typo. It is now corrected.

Mike

Thanks for the info.

Comments are closed