mirror of https://github.com/AMT-Cheif/Stylet.git
Stylet.Start should save files in UTF-16 with BOM
This is the encoding which VS uses, so let's be consistent. We were previously saving as UTF-8 without a BOM, which VS seemed to be interpreting as ASCII, and was throwing a wobbly if non-ASCII characters were later added. Fixes #30
This commit is contained in:
parent
41527ff7e9
commit
b7e79f5f6c
|
@ -6,6 +6,8 @@ param($installPath, $toolsPath, $package, $project)
|
|||
$rootNamespace = $project.Properties.Item("RootNamespace").Value
|
||||
$rootPath = $project.Properties.Item("LocalPath").Value
|
||||
|
||||
# VS writes its files as UTF-16 with a BOM. We should do the same.
|
||||
$encoding = [System.Text.Encoding]::Unicode
|
||||
|
||||
# Modify App.xaml
|
||||
# This is a real ballache: the previous Stylet.Start package (which uses NuGet's 'content' approach)
|
||||
|
@ -32,7 +34,7 @@ if ($existingAppXaml -eq $null)
|
|||
</Application.Resources>
|
||||
</Application>"
|
||||
|
||||
[System.IO.File]::WriteAllText($appXamlPath, $appXamlContent)
|
||||
[System.IO.File]::WriteAllText($appXamlPath, $appXamlContent, $encoding)
|
||||
$appXaml = $project.ProjectItems.AddFromFile($appXamlPath)
|
||||
$appXaml.Properties.Item("BuildAction").Value = 4 # ApplicationDefinition
|
||||
}
|
||||
|
@ -99,7 +101,7 @@ else
|
|||
$appXaml = $appXaml.Replace(" xmlns=", "`r`n xmlns=")
|
||||
$appXaml = $appXaml.Replace(" xmlns:", "`r`n xmlns:")
|
||||
|
||||
[System.IO.File]::WriteAllText($appXamlPath, $appXaml)
|
||||
[System.IO.File]::WriteAllText($appXamlPath, $appXaml, $encoding)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -135,7 +137,7 @@ namespace ${rootNamespace}
|
|||
}
|
||||
"
|
||||
$bootstrapperPath = [System.IO.Path]::Combine($rootPath, "Bootstrapper.cs")
|
||||
[System.IO.File]::WriteAllText($bootstrapperPath, $bootstrapperContent)
|
||||
[System.IO.File]::WriteAllText($bootstrapperPath, $bootstrapperContent, $encoding)
|
||||
$null = $project.ProjectItems.AddFromFile($bootstrapperPath)
|
||||
}
|
||||
|
||||
|
@ -275,8 +277,8 @@ else
|
|||
$shellViewPath = [System.IO.Path]::Combine($rootPath, "Pages", "ShellView.xaml")
|
||||
$shellViewCsPath = $shellViewPath + ".cs"
|
||||
|
||||
[System.IO.File]::WriteAllText($shellViewPath, $shellViewContent)
|
||||
[System.IO.File]::WriteAllText($shellViewCsPath, $shellViewCsContent)
|
||||
[System.IO.File]::WriteAllText($shellViewPath, $shellViewContent, $encoding)
|
||||
[System.IO.File]::WriteAllText($shellViewCsPath, $shellViewCsContent, $encoding)
|
||||
|
||||
$shellView = $pages.ProjectItems.AddFromFile($shellViewPath)
|
||||
# This should have been added automagically, but just in case...
|
||||
|
@ -305,7 +307,7 @@ namespace ${rootNamespace}.Pages
|
|||
"
|
||||
|
||||
$shellViewModelPath = [System.IO.Path]::Combine($rootPath, "Pages", "ShellViewModel.cs")
|
||||
[System.IO.File]::WriteAllText($shellViewModelPath, $shellViewModelContent)
|
||||
[System.IO.File]::WriteAllText($shellViewModelPath, $shellViewModelContent, $encoding)
|
||||
$null = $pages.ProjectItems.AddFromFile($shellViewModelPath)
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue