I strongly suggest that you separate all common classes (this is, classes that will be used in T4 and outside T4) in a common assembly, which can then be referenced by your project and your T4 Templates:
MySolution
|
| -> MyProject.Common
| |--> ClaimConfig.cs
|
| -> MyProject.Main
| |--> References
| | |--> MyProject.Common
| | MyT4Template.tt
So that the compilation of MyProject.Common
(which contains all classes needed to successfully compile the Main project AND the T4 Templates) is separated.
Then in your template:
<#@ assembly name="C:\Users\username\Documents\Visual Studio 2012\Projects\MyProjectSolution\MyProject.Common\bin\Debug\MyProject.Common.dll" #>
Also, I strongly suggest you use a T4 Editor, such as Tangible T4 Editor, it's going to help you A LOT when editing T4 templates, mainly because it clearly highlights and makes a visual difference between "resulting code" (I.E the template output) and "generating code" (the code inside the template). They provide a free version, as well as a commercial full version. I use the free version and it has been really helpful so far.