We are able to run the code generation through the Visual Studio IDE (Right click -> Regenerate for all items)

Are there other options available, such as Project Build targets or an external program that can be run?

The reason for this is that we have (or will have) many projects within a Helix / Habitat style architecture, and would like to run all the code generation at certain times.

  • You're probably wanting to use something like this: hermanussen.eu/sitecore/wordpress/2015/04/…
    – jammykam
    Commented Oct 21, 2016 at 10:44
  • When running code gen 'at certain times', does that necessarily have to be at build time outside of the IDE? Or would a feature request for 'Re-Generate all generated code in the solution' still from within the IDE be helpful? Commented Oct 21, 2016 at 14:24
  • When you say code generation, do you mean deploy? I would think code generation occurs during development of a discreet Module. Commented Oct 24, 2016 at 4:37
  • @SeanHolmesby A "regenerate all code in the solution" would be helpful, yes. The main point is that I'd rather have the GeneratedCode.cs (or whatever the file name is) to not be checked in, and to generate on the build server, or locally if there is no regen option
    – Dan
    Commented Oct 24, 2016 at 8:42

1 Answer 1


Unfortunately, this is not currently possible.

The explanation is that since MSBuild doesn’t include the T4 processing engine inside its build components, TDS isn’t able to make a call to it during the execution of a build.

This is the main reason why code needs to be generated and checked-in before builds happen.

  • I'm sure I have seen the T4 template used with MSBuild before. I will need to look for this somewhere
    – Dan
    Commented Oct 21, 2016 at 10:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.