File tree Expand file tree Collapse file tree 1 file changed +15
-2
lines changed
Expand file tree Collapse file tree 1 file changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -171,13 +171,26 @@ if ($Mode -eq "Canary") {
171171 }
172172 }
173173
174- $xml.Save ($ManifestPath )
174+ # 使用 XmlWriter 设置编码,防止乱码
175+ $settings = New-Object System.Xml.XmlWriterSettings
176+ $settings.Indent = $true
177+ $settings.Encoding = [System.Text.Encoding ]::UTF8
178+ $writer = [System.Xml.XmlWriter ]::Create($ManifestPath , $settings )
179+ $xml.Save ($writer )
180+ $writer.Close ()
175181} else {
176182 # Release 模式也要更新 Version
177183 $ManifestPath = " $PackDir \AppxManifest.xml"
178184 [xml ]$xml = Get-Content $ManifestPath
179185 $xml.Package.Identity.Version = $BuildVersion
180- $xml.Save ($ManifestPath )
186+
187+ # 同样使用 XmlWriter
188+ $settings = New-Object System.Xml.XmlWriterSettings
189+ $settings.Indent = $true
190+ $settings.Encoding = [System.Text.Encoding ]::UTF8
191+ $writer = [System.Xml.XmlWriter ]::Create($ManifestPath , $settings )
192+ $xml.Save ($writer )
193+ $writer.Close ()
181194}
182195
183196# ==========================================
You can’t perform that action at this time.
0 commit comments