I'm using T4 templates (run-time generated) to generate few .cs files for my project (controller, entity and views) that needs to be created dynamically by my controller's action, which pass specific data to these templates.
It's the way I generate them in my action:
CustomEntity entity = new CustomEntity(entityName, propertyMap);
String entityContent = entity.TransformText();
System.IO.File.WriteAllText(Server.MapPath("~") + "\\Models\\" + entityName + ".cs", entityContent);
CustomEntityController controller = new CustomEntityController(entityName);
String controllerContent = controller.TransformText();
System.IO.File.WriteAllText(Server.MapPath("~") + "\\Controllers\\" + entityName + "Controller.cs", controllerContent);
They are generated properly, but however they are not inluded in my project, so I can't use them in my project anyway. Only right-button click on the file and "Include in project" solve this issue, but I need them accessible in my project automatically.
How can I solve this problem?