Skip to content

Commit

Permalink
Merge pull request ElectronNET#32 from tebeco/no_xml_declaration_in_c…
Browse files Browse the repository at this point in the history
…sprojet

use XmlWritter to avoid serialising Xml Declaration in csproj
  • Loading branch information
robertmuehsig authored Nov 4, 2017
2 parents 0b351bb + 04b41c0 commit 93b7c94
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions ElectronNET.CLI/Commands/InitCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using System.Xml;
using System.Xml.Linq;

namespace ElectronNET.CLI.Commands
Expand Down Expand Up @@ -147,10 +148,19 @@ private static bool EditCsProj(string projectFile)
stream.SetLength(0);
stream.Position = 0;

xmlDocument.Save(stream);
var xws = new XmlWriterSettings
{
OmitXmlDeclaration = true,
Indent = true
};
using (XmlWriter xw = XmlWriter.Create(stream, xws))
{
xmlDocument.Save(xw);
}

Console.WriteLine($"{ConfigName} added in csproj!");
}

Console.WriteLine($"{ConfigName} added in csproj!");
return true;
}
}
Expand Down

0 comments on commit 93b7c94

Please sign in to comment.