Task for pre-processing source files
- Dominant language
- C#
- Stars
- 5.5k
- Forks
- 1.5k
- Avg merge
- 1d 8h
- Merged PRs (30d)
- 141
Description
I'd like to contribute to MSBuild a task we wrote for aspnet that I think would be generally useful. Is this something MSBuild would accept as a PR?
### GenerateFileFromTemplate
Purpose: pre-process a source file using MSBuild variables.
**Usage:**
```xml
```
**Template file example**
```
// MyFile.cs.in
public class ${ClassName}
{
public void Method${MethodName}()
{
Console.WriteLine("`${NotReplacedDueToBacktick}"");
}
}
```
**Template syntax**:
* variables in the template file use powershell/bash syntax: `${VarName}`.
* if you need a file with `${...}`, you can escape this with a backtick: `${...}
**Justification**:
WriteLinesToFile is good, but I've frequently run into problems with it when I need to write a file that has `\`, `/`, or `;` in it.
Current implementation: https://github.com/aspnet/BuildTools/blob/master/modules/BuildTools.Tasks/GenerateFileFromTemplate.cs, https://github.com/aspnet/BuildTools/blob/master/test/BuildTools.Tasks.Tests/GenerateFileFromTemplateTests.cs
cc @jeffkl @livarcocc
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.