Skip to content

Settings.ShowLicenseInfo

Simon Hughes edited this page Aug 30, 2026 · 2 revisions

Settings.ShowLicenseInfo, Settings.IncludeGeneratorVersionInCode and Settings.IncludeConnectionSettingComments

Three settings controlling what provenance information the generated file carries about itself.

Setting Type Default Writes
Settings.ShowLicenseInfo bool false Your licence details as a header comment
Settings.IncludeGeneratorVersionInCode bool false The generator version. Needs ShowLicenseInfo on too
Settings.IncludeConnectionSettingComments bool false The database edition and version read at generation time

All three are in Database.tt and apply everywhere.

What they do

ShowLicenseInfo adds a comment naming who the generator is licensed to. Useful if you want the provenance recorded in the source; noise otherwise.

IncludeGeneratorVersionInCode adds the generator's version number - but only when ShowLicenseInfo is also true. On its own it does nothing, which is the single most confusing thing about these three.

IncludeConnectionSettingComments records what the generator found when it connected:

// Database Edition       : Developer Edition (64-bit)
// Database Engine Edition: Enterprise
// Database Version       : 14.0.3540.1

That is genuinely useful when a generated file behaves differently on two machines. Several features are version-gated - temporal tables need SQL Server 2016, json and vector need 2025 - so "which server was this generated against?" is a real question with a real answer here.

When to use them

IncludeConnectionSettingComments on a shared codebase. If more than one person regenerates, recording which server produced the file turns "why does your output differ from mine?" into a two-second check.

ShowLicenseInfo and IncludeGeneratorVersionInCode together for auditability - which generator version produced this file, under which licence. Worth it in a regulated environment and pointless otherwise.

Leave all three off by default, which is what the shipped .tt does. Every one of them adds churn: the version changes when you upgrade, the connection details change when you generate from a different server, and a diff full of comment changes hides the real change.

Gotchas

IncludeGeneratorVersionInCode does nothing on its own. It is gated on ShowLicenseInfo. Turn both on.

They add diff noise. IncludeConnectionSettingComments in particular changes whenever anyone patches the database server, so a routine SQL Server update shows up as a change to every generated file.

ShowLicenseInfo writes licence details into source control. It is your name and company, not a key, so it is not a secret - but it is personal data appearing in a public repository if the project is open source.

Azure SQL reports differently. IncludeConnectionSettingComments shows the Azure engine edition rather than an on-premises one, which is correct and looks odd the first time.

[GeneratedCode] is a different setting. Settings.IncludeCodeGeneratedAttribute records the version as an attribute on each class, for tooling rather than for humans, and does not need ShowLicenseInfo.

See also

Clone this wiki locally