20Dec, 2020
Adding a Project to Your Helix Solution and How Tds Can Break Your Sitecore Instance
Today I was adding a project to our Helix solution, and was a little surprised to see the instance break after first deployment. The fix was simple but nowhere near straightforward. Before we get to the problem and how to fix it, here are the steps I take. Let's call this new project Metadata.
- Create a new folder in src/feature called Metadata.
- In Visual Studio, create a .net project called Sitecore.Feature.Metadata, and ensure it's in this new folder you just made. You can observe another project in Sitecore's Helix project to make sure the folder path is of the same pattern.
- Set the runtime version in this project to the same as the other projects.
- Create a TDS project in the same folder (src/feature/metadata), and name it Sitecore.Feature.Metadata.Master.
- Open the configuration manager for Visual Studio and check the new project is set the same as the other ones. For instance, if you have a pull request build that executes non-TDS projects, set the new ones the same as the others.
- Go back to your new TDS project. In the properties of this project under source web projects, select the one above that you just made.
- In the build tab, ensure the output path is set since it should populate with the current configuration value.
- Right click on the solution node and go to project dependencies. Switch to the Deploy project at the bottom, and make sure your new projects are selected. This will set the build order for you.
- Go to the Sitecore.Project.Deploy project and under multi project properties -> package bundling, make sure your project is checked.
Now what went wrong?
Even though I've done this a few times, I got tripped up today. If you don't restrict assemblies in the TDS configuration, it will deploy them all. So, what was happening, is on first build all references were also getting sent to my Sitecore instance which would break it. This means the NoReference collection was getting deployed, etc. Setting the assemblies to include only Sitecore.Feature.Metadata.dll in this case resolved the assembly conflict.
