vsts-assemblyinfo-task
vsts-assemblyinfo-task copied to clipboard
How to fix iso-8859-2 Encoding warning?
##[warning]Detected file encoding (iso-8859-2) is different to the one specified (utf-8). Hi,
my .csproj file ist utf-8 and task is also with utf-8 encoding:
Everything works fine incl. copyright symbol ©.
I just want to remove warning message.
Thanks!
Ran into same issue recently. Is there any plan to fix this? Thanks
I had the same issue, but was able to fix it for myself adding BOM to my CSPROJ files.
So all I did was opening my CSPROJ files and then save them using the encoding UTF-8 with BOM
(in VS Code).
This makes sure the task correctly detects the file as UTF-8.
By the way it also seems to be an easy fix to add a "supress file encoding warnings" flag, and change the following part:
https://github.com/BMuuN/vsts-assemblyinfo-task/blob/6369290d2ca61302bbadbfbd60241419e01f8910/src/netframework/index.ts#L229-L240
as such:
function setFileEncoding(file: string, model: models.NetFramework) {
const encoding = getFileEncoding(file);
logger.debug(`Detected file encoding: ${encoding}`);
model.detectedFileEncoding = model.fileEncoding;
if (model.fileEncoding === 'auto') {
model.detectedFileEncoding = encoding;
} else if (model.fileEncoding !== encoding && !model.supressFileEncodingWarnings) { // <-- CHANGE HERE
logger.warning(`Detected file encoding (${encoding}) is different to the one specified (${model.fileEncoding}).`);
}
}
I'm happy to make a PR for this if required, however I think adding the BOM to the files should be sufficient. However, it'd probably be best to add that to the documentation (maybe here?), which I'm also happy to do.