I have encountered a small problem with my T4 code generation.
I have broken my T4 templates up into separate files and placed them in various directories, I have done this so parts of my code generation may be re-used in multiple projects, e.g. model generation, repository generation and service generation all include a core EntityGeneration.tt file.
Unfortunately, when TextTemplating resolves my nested includes, it builds up a long #line pre-processor directive in its generated .cs file, combining all of the relative paths to the lowest level included file.
Unfortunately, as this path is built up with relative paths, it ends up needlessly long, so long in fact that it exceeds the maximum path length (Windows 7).
Here is the line at fault from the generated code in case you are interested:
#line 3 "C:\VS2010\AlbatrossTravelGroup\ASC\AlbatrossTravelGroup.ASC.BusinessRules\Services\Contracts\..\..\..\..\AlbatrossTravelGroup.BusinessRules\Services\Contracts\..\..\..\AlbatrossTravelGroup.Models\Repositories\Contracts\..\..\../AlbatrossTravelGroup.Common/CodeGeneration.tt"
My question is this, how can I disable these directives being written to the generated code file? Failing that, how can I avoid this problem without changing my file structure?
Disabling an app will remove it from the apps screen and stop it from running in the background. Disabled apps will no longer receive updates. Depending on where you bought your device, different apps may be preinstalled.
Visual Studio 2012 adds the linePragmas="false"
template directive:
<#@ template language="C#" linePragmas="false" #>
http://msdn.microsoft.com/en-us/library/gg586945(v=vs.110).aspx
Still not sure how to do this in VS2010 which I'm stuck with at work.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With