File tree Expand file tree Collapse file tree
tools/Explicit.NuGet.Versions Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -41,7 +41,7 @@ private static void UpdateNuspecManifestContent(Dictionary<string, NuspecContent
4141 SetPackageDepencyVersionsToBeExplicitForXmlDocument ( nuspecXmlDocument , dependencyNugetId ) ;
4242
4343 string updatedNuspecXml ;
44- using ( var writer = new StringWriter ( new StringBuilder ( ) ) )
44+ using ( var writer = new StringWriterWithEncoding ( Encoding . UTF8 ) )
4545 using ( var xmlWriter = new XmlTextWriter ( writer ) { Formatting = Formatting . Indented } )
4646 {
4747 nuspecXmlDocument . Save ( xmlWriter ) ;
@@ -60,7 +60,9 @@ private static void SetPackageDepencyVersionsToBeExplicitForXmlDocument(XmlDocum
6060 {
6161 var currentVersion = node . Attributes [ "version" ] . Value ;
6262 if ( ! node . Attributes [ "version" ] . Value . StartsWith ( "[" ) && ! node . Attributes [ "version" ] . Value . EndsWith ( "]" ) )
63+ {
6364 node . Attributes [ "version" ] . Value = $ "[{ currentVersion } ]";
65+ }
6466 }
6567 } ) ;
6668 }
@@ -102,4 +104,19 @@ private static void WalkDocumentNodes(XmlNodeList nodes, Action<XmlNode> callbac
102104 }
103105 }
104106 }
105- }
107+
108+ public sealed class StringWriterWithEncoding : StringWriter
109+ {
110+ private readonly Encoding encoding ;
111+
112+ public StringWriterWithEncoding ( Encoding encoding )
113+ {
114+ this . encoding = encoding ;
115+ }
116+
117+ public override Encoding Encoding
118+ {
119+ get { return encoding ; }
120+ }
121+ }
122+ }
You can’t perform that action at this time.
0 commit comments