dotnet / dotnet/msbuild

WriteLinesToFile Does Not Support BOM Customization

Open
#6,168 0 comments 4 reactions 0 assignees View on GitHub
help wanted needs-design triaged
Dominant language
C#
Stars
5.5k
Forks
1.5k
Avg merge
1d 8h
Merged PRs (30d)
141

Description

## Context
The WriteLinesToFile task uses UTF-8 encoding without BOM (byte order mark) by default. This is not specified in [the documentation](https://docs.microsoft.com/visualstudio/msbuild/writelinestofile-task) and could be useful to have control over.

The difficulty is allowing control over the optional `Encoding` parameter _and_ control over the BOM without adding a special case for every single encoding.

Some options I sent in the internal thread that started this issue:
1. We pick a few encodings that are most common/popular/etc. and special case those and no others.
1. We can pass an optional parameter to override whether s_defaultEncoding applies a BOM.

Let's discuss what potential solutions there are before implementing an improvement.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.