SDL Tridion Quick Tip: Embedding Parameters Schemas in DLLs

One thing that is a barrier to reuse of Template Building Blocks across different projects is the problem of having to upload the Parameters Schemas for the Template Building Blocks each time.

This can be solved by embedding the Schemas as resources in the Template Building Block DLL. The TcmUploadAssembly executable will automatically create the Parameter Schema for you.

The disadvantage of this approach is that your schemas will end up in the same folder as your TBBs and if you then make changes to the Schema in SDL Tridion you need to remember to update the XSD file in your project with your changes.

However, this makes for much easier installation of a set of Template Building Blocks so can only help reuse.

To achieve this:

  1. Add your schemas as XSDs to your Visual Studio project in a folder called "Resources"
  2. Open the properties of the XSD and set the Build Action to "Embedded Resource"
  3. Add the schema to your Template Building Blocks like so:
    [gist id=3927445]
  4. Run the TcmTemplateUploadAssembly tool
  5. You will now see your schema in the same folder as your TBBs

I thought this was a neat time saving trick when I noticed it in the DD4T Templates project and it would be good to share it!

Please note I have only tried this in SDL Tridion 2011 SP1.

Any questions?

If you need more information or have any questions just get in touch and we'd be happy to answer them for you.