There is a problem with encodings. If you set your project's EncodingToUse = ASCII, the UserCodeRegions in a LPT template can wiped out.
Reason:
This is because the original file is ALWAYS read in as Unicode. DotNetTemplateEngine.TestFileCanBeOverwritten reads the original file using the DotNetTemplateEngine._encodingToUse variable, which is set to Encoding.Unicode and never changed.
When the template output is written, it uses a local _encodingToUse variable that is set to the encoding of the project.
So if the project is set to ASCII, the file is written in ASCII. When the file is regenerated, the original file is read in Unicode which does not allow regex to always properly match the usercode regions so they can be wiped out.
Solution:
Quick: Set your projects encoding to 'UTF8' or 'UNICODE'
Longer: Modify the DotNetTemplateEngine._encodingToUse variable to return the encoding of the project.