Сообщение Re[15]: API и слоёные архитектуры от 14.09.2016 17:33
Изменено 14.09.2016 18:05 Arsen.Shnurkov
Там же написано, что в точности всё равно не получается, потому что расположение атрибутов относительно элемента может быть изменено.
Mind that PreserveWhitespace preserves only elements indentation. If you have attributes in new lines or multiline values they will be reformatted.
Ещё есть SaveOptions.DisableFormatting, надо попробовать...
У меня мысль была — раз рослин служит для создания редакторов разных синтаксисов,
то научиться описывать синтсаксис .csproj для Roslyn как платформы.
Там же написано, что в точности всё равно не получается, потому что расположение атрибутов относительно элемента может быть изменено.
Mind that PreserveWhitespace preserves only elements indentation. If you have attributes in new lines or multiline values they will be reformatted.
Ещё есть SaveOptions.DisableFormatting, надо попробовать...
Но говорят, что надо переписать XmlWriter:
I believe that LoadOptions.PreserveWhitespace and SaveOptions.DisableFormatting only instruct XDocument on how to handle whitespace in terms of indentation and the content of text nodes. It would still normalize the attributes, etc.
You may wish to use an overload where you specify an XmlWriter that is configured to do what you want, and if you can't find a configuration that works with the default XmlTextWriter, you could always create your own XmlWriter.
У меня мысль была — раз рослин служит для создания редакторов разных синтаксисов,
то научиться описывать синтсаксис .csproj для Roslyn как платформы.