I have created T4 Templates for the config files of my web and windows projects. I can successfully generate master web.config, and all configs for other environments, i.e. web.ci.config, etc..However, I could not get rid of the errors on my master tt files, such as :
- Character '#', hexadecimal value 0x23 is illegal in an XML name.
- Character '<', hexadecimal value 0x3c is illegal in XML attribute values.
- Unexpected XML declaration. The XML declaration must be the first node in the document and no white space characters are allowed to appear before it.
I should be missing a xml schema or a reference, but what?
My file looks like:
<#@ template debug="true" hostSpecific="true" #> <#@ output extension= ".config" #> <?xml version="1.0" encoding="utf-8"?> <configuration> ... <add key="FileUploadFolder" value="<#= this.FileUpload #>" /> ... </configuration> <#+ string FileUpload="\\\\server\\folder"; #>
And here is screenshot