texttemplate

Custom Output File Path For T4 Template

这一生的挚爱 提交于 2019-12-22 11:12:18
问题 I am finding it really difficult to use t4 templates with a non-standard directory structure. I am using links inside my csproj file, which seems to be at the root of the problem. I have it working, however, VS automatically makes a change which breaks things. I've have the following directory structure: /source + MyLib.cs /generate /MyLib + MyLib.tt + MyLib.A.t4 // included by MyLib.tt + MyLib.B.t4 // included by MyLib.tt + MyLib.C.t4 // included by MyLib.tt /build_examples /vs + MyLib

How do I pass a string parameter to a t4 template

倖福魔咒の 提交于 2019-12-18 10:44:31
问题 Hi I am trying to find a way to pass a normal string as a parameter to a text template. This is my Template code, if someone could tell me what I would need to write in c# to pass my parameters and create the class file. That would be very helpful, Thanks. <#@ template debug="false" hostspecific="true" language="C#" #> <#@ output extension=".cs" #> <#@ assembly name="System.Xml" #> <#@ assembly name="EnvDTE" #> <#@ import namespace="System.Xml" #> <#@ import namespace="System.Collections

Clearing Custom Tool file property in Visual Studio 2010

白昼怎懂夜的黑 提交于 2019-12-08 13:50:18
问题 Is there any way to prevent prevent a custom tool from running or remove the custom tool for a file type per project in Visual Studio? In my example I would like to add a file to my project with an extension (.tt) that Visual Studio assoicates with the TextTemplatingFileGenerator. I would like to not have to go into the file properties and clear the Custom Tool property as well as clean up any work done by the single file generator that runs when adding the file to my project. 回答1: In the

Custom Output File Path For T4 Template

こ雲淡風輕ζ 提交于 2019-12-06 03:54:34
I am finding it really difficult to use t4 templates with a non-standard directory structure. I am using links inside my csproj file, which seems to be at the root of the problem. I have it working, however, VS automatically makes a change which breaks things. I've have the following directory structure: /source + MyLib.cs /generate /MyLib + MyLib.tt + MyLib.A.t4 // included by MyLib.tt + MyLib.B.t4 // included by MyLib.tt + MyLib.C.t4 // included by MyLib.tt /build_examples /vs + MyLib.csproj + MyLib.sln MyLib.csproj looks like this: <?xml version="1.0" encoding="utf-8"?> <Project

How do I pass a string parameter to a t4 template

北慕城南 提交于 2019-11-29 23:13:36
Hi I am trying to find a way to pass a normal string as a parameter to a text template. This is my Template code, if someone could tell me what I would need to write in c# to pass my parameters and create the class file. That would be very helpful, Thanks. <#@ template debug="false" hostspecific="true" language="C#" #> <#@ output extension=".cs" #> <#@ assembly name="System.Xml" #> <#@ assembly name="EnvDTE" #> <#@ import namespace="System.Xml" #> <#@ import namespace="System.Collections.Generic" #> <#@ parameter name="namespacename" type="System.String" #> <#@ parameter name="classname" type=