Debug tt templates in VS2008
Is there a way to debug tt files? I have installed SubSonic3 and all the templates do their job except the StoredProcedures.tt. It remains empty after 'Run Custom Tool'. ...
Is there a way to debug tt files? I have installed SubSonic3 and all the templates do their job except the StoredProcedures.tt. It remains empty after 'Run Custom Tool'. ...
I'm new to T4 but I have stumbled accross it and it looks very useful. I'm trying to generate some simple DA classes and need some advice one a particular part of my code. Hoe can i generate the following code given that I already have the table name and column names (in this case "Agreements" and "AgreementId", "ContactId", etc)? if ...
I would like to create a custom parameter for a vstemplate containing some C# code. Basically I want to put DateTime.Now.ToString("yyyyMMddHHmmssfff") in my template (the formatted date, not the code). Basically I want to achieve the equivalent of the T4 below in my item template. [Migration(<#= DateTime.Now.ToString("yyyyMMddHHmmssfff"...
Is there a way to programmatically run T4 text templates from code? I'm making a custom domain specific language and I would like the related text templates to run every time the user saves. Currently, this is what I do in the DSL model: protected override void OnDocumentSaved(EventArgs e) { IVsCommandWindow commandWindow = (IVsComm...
Hi all, I have a c# project which includes a Text Template. I would like this template to generate some SQL based on reflecting against the C# classes in the project. How does one access the current project's contents using T4? Is it possible, and if so, is Reflection available, or is it access to just the raw source that must then be ...
I'm creating a t4 template that will generate an enum from a number of values in our database. The weird thing is that as soon as I try to create a DataTable in the template code i get the ErrorGeneratingOutput message: <#@ template language="C#v3.5" debug="True" #> <#@ output extension="CS" #> <#@ assembly name="System.Data" #> <#@ as...
We're trying to learn to use T4 Templates. I have a desire to use the System.Data.Entity.Design.PluralizationServices library in order to better pluralize some Entity Model names within my template, but I've come across some issues in the achievement of this goal. Running code to generate output text. I think this is possible, but ...
I've got a T4 template (also using the T4Toolbox) that scans a folder for files, then processes them and kicks out .cs files. When the processing from the template is done, I want to format them with VS. I've got this far: IServiceProvider hostServiceProvider = (IServiceProvider)Host; EnvDTE.DTE dte = (EnvDTE.DTE)hostServiceProvider.Get...
All the sudded T4 Templates stopped working on my machine. I get this error The custom tool 'TextTemplatingFileGenerator' failed. Specified cast is not valid. I tried to repair Visual Studio but no luck. Note I am running 64bit machine but 32bit Visual Studio 2008. What is odd is it worked great for some time then all the sudden s...
I downloaded and installed the latest version of the T4 Toolbox for VIsual Studio 2010, in an attempt to create LINQ business objects, but I'm having some troubles with it. First, I was getting errors saying it couldn't find T4Toolbox.tt and T4Toolbox\LinqtoSql.tt in my project directory, but that's not where they are installed. Am I to...
I'm trying to add the T4MVC templates to my project, but I'm experiencing some problems. I went to Codeplex and downloaded the latest version of T4MVC, and according to the instructions I just copied the two files T4MVC.tt and T4MVC.Settings.t4 into the root of my web application. Immediately, I got the following errors: From T4MVC.cs ...
I'm interested in purchasing a full features T4 editor. I'm looking at: Tangible T4 Editor Professional Clarius Visual T4 Editor Professional They both have the same price tag (100$). Clarius' product seems a bit more feature rich, but is it really? And if it is, is it then more memory hungry as it's usual with rich Visual Studio pl...
Why do my T4 templates sometimes append a number to the output file and sometimes not? For instance, in one case I might have a template file called Foo.tt and I'll get an output file of Foo.cs. In other cases, I'll get an output file of Foo1.cs. In every case, there is no other Foo.cs file that might be causing it to append a number. In...
Hey guys, I was wondering--what part of Subsonic 3 needs to be modified to support a different database under a Simple Repository scenario? I haven't found any documentation on this point. Subsonic 3 seems to be all about the T4 templates but when I check out the Subsonic project sources I don't see any T4 templates in there...so wher...
I'm using the T4 toolbox's Linq to SQL model to generate code, and I'd like to add some serialization properties to the code that it generates. I'm not sure how to modify the generator to do this. Would I modify the actual .tt file that is installed with the toolbox? Or can I add something to the .tt file that gets created for me? Or do ...
I'm using the T4 toolbox Linq to SQL generator, and after making a WCF call, the association properties on my object are null and throwing a null reference exception in their setters. This is one such property: [DataMember(Order = 4, EmitDefaultValue = false)] [Association(Name = "Family_FamilyConfiguration", Storage = "familyConfigurat...
I have a T4 template for a class set up with TextTemplatingFileGenerator Custom Tool in Visual Studio: <#@ template language="C#v3.5" hostspecific="True" debug="True" #> <# var className = System.IO.Path.GetFileNameWithoutExtension(Host.TemplateFile); var namespaceName = "MyNamespace"; #> namespace <#= namespaceName #> { public...
I am trying to get the folder names inside the Views folder using T4 Template and it keeps giving me the following errors: Error 3 Compiling transformation: The name 'Server' does not exist in the current context c:\Projects\LearningASPMVC\LearningASPMVCSolution\LearningMVC\StronglyTypedViews.tt 20 47 Error 4 A namespace doe...
T4 has existed for several years in Visual Studio, but doesn't get a lot of attention. However, for those that know it, there seems to be some very creative and useful purposes. I am researching some different ways that T4 is used, and I would appreciate to hear how YOU may have used it for real life scenarios. I am primarily interest...
I am trying to use T4 for source code generation. Mostly, I am able to generate individual files using it. Can you please provide me some information on how to create a complete visual studio directory (preferably separate from T4 template directory) having the below sample structure: /MyProject – Contains MyProject.sln. /app - Contains...