0

I have a T4 template that needs to access an integer constant so it can generate the correct file structure at build time. The generated file is not source code and so cannot access this constant at run time. This constant should also be available to my C# source code at runtime.

Ideally I would like only one place to set the value of this integer constant to avoid maintenance problems in the future where colleagues may set the value in the C# code one place and forget to set it in the template.

Where can I place this constant so I only have to edit it in one place?

mmmmmm
  • 32,227
  • 27
  • 88
  • 117
bradgonesurfing
  • 30,949
  • 17
  • 114
  • 217

1 Answers1

1

I would put it in the app.config/web.config file, and read that in the T4 template, and the source code.

podiluska
  • 50,950
  • 7
  • 98
  • 104