I\'m building a nuget package for my company MVC4 template. I have run into an issue where I need the Global.asax.cs
to be modified to add these two lines:
If you want to "replace" some text in some file you can do like this:
$file = $project.ProjectItems | ForEach-Object { $_.ProjectItems } | where { $_.Name -eq "Global.asax.cs" }
if($file) {
$file.Open()
$file.Document.Activate()
$file.Document.Selection.StartOfDocument()
$file.Document.ReplaceText("TextToFind`n", "TextToReplace")
}
Note the `n
which is escaping for \n or enter (CR).
If you need quote character "
it can be escaped as `"
as well