t4 - Can CodeDom add Source Code Files to a Project? -


I'm using CodeDom to generate some code. It works great, but I have not found any way to include source code files generated in the project. I started generating T4 and code because this project supports integration with files

Do anyone know whether the codedom also supports this functionality? I would like to take a second look at codeDom, if it supports only one attribute.

Here is an example of how I file a source code with codedom:

  Secure Zero CreateSourceFile (CodeCompileUnit codeCompileUnit, string filename, Extension with string filename description ) {FileNameWithExtension = string.Format ("{0}. {1}", filename, CodeProvider.FileExtension); Var indentedTextWriter = New IndentTextUpter (new streamer (filename extension, incorrect), tabstring;); CodeProvider.GenerateCodeFromCompileUnit (codeCompileUnit, indentedadvertiser, new CodeGeneratorOptions ()); IndentedTextWriter.Close (); }  

This works fine, but it only outputs the file (probably bin folder) to the hard drive.

Here is another example of some code that I use T4, it specifies the output as part of a project that is converted into a template:

  Public class RDFSClassGenerator: Generator {Private redone String Root namespace; Private readonly string otology location; Public RDFSClassGenerator (string root namespace, string ontology location) {this.rootNamespace = rootNamespace; This.ontologyLocation = ontologyLocation; } Protected Override Zero Runcore () {Explanation Autologia = Excl .load (autocomposition); Var service = new RDFSGeneratorService (autology); Foreign Currency (Metaclass Metaclass In Service.MatClasses) {var rdfsClassTemplate = New RDFSCL template (Route namespace, Metaclass); RdfsClassTemplate.Output.File = "Domain /" + metaClass.Name + ".cs"; RdfsClassTemplate.Render (); }}}  

Then the T4 code will output the file to the "domain" folder of my project. But CodeGen content only outputs the file to disk and does not update the project file.

Here is a view:

alt text < / P>

Yes, it can. Here's how:


Comments

Popular posts from this blog

c# - sqlDecimal to decimal clr stored procedure Unable to cast object of type 'System.Data.SqlTypes.SqlDecimal' to type 'System.IConvertible' -

Calling GetGUIThreadInfo from Outlook VBA -

Obfuscating Python code? -