I whant to preserve the content of the "Custom Code" region in a C# generated file
#region Custom Code NameSpaces
//Code I want to preserv
string comment = "";
#endregion
It works in batch with the console application like this:
cs /p:EntityName=CodeType /out:CodeType.cs /t:Entity.cst /p:EntityMap=Entities.Map.xml /merge:PreserveRegions="RegionNameRegex=^[ \t]*(?i:Custom Code);Language=C#;"
I have tries these 4 solutions from a template file and none works, there are other post in the forum for the same problem but none have a working solution !
CodeSmith.Engine.PreserveRegionsMergeStrategy strategy = new CodeSmith.Engine.PreserveRegionsMergeStrategy("^[ \t]*(?i:Custom Code)","C#");
entityTemplate.RenderToFile(outputFolder, strategy);
CodeSmith.Engine.PreserveRegionsMergeStrategy strategy = new CodeSmith.Engine.PreserveRegionsMergeStrategy();
strategy.RegionNameRegex = "^[ \t]*(?i:Custom Code)";
strategy.Language = "C#";
entityTemplate.RenderToFile(outputFolder, strategy);
CodeSmith.Engine.PreserveRegionsMergeStrategy strategy = new CodeSmith.Engine.PreserveRegionsMergeStrategy();
strategy.RegionNameRegex = "Custom Code"; //might use the config file ??
strategy.Language = "C#";
entityTemplate.RenderToFile(outputFolder, strategy);
CodeSmith.Engine.PreserveRegionsMergeStrategy strategy = new CodeSmith.Engine.PreserveRegionsMergeStrategy();
strategy.Init("RegionNameRegex=^[ \t]*(?i:Custom Code);Language=C#;");
entityTemplate.RenderToFile(outputFolder, strategy);
Could you give a simple example of how this should be done ?
Thanks