Created
March 23, 2012 18:51
-
-
Save jchadwick/2173751 to your computer and use it in GitHub Desktop.
Revisions
-
jchadwick revised this gist
Mar 26, 2012 . 1 changed file with 13 additions and 7 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,18 +1,24 @@ param($installPath, $toolsPath, $package, $project) Write-Host "Setting Application to DowJones.Web.Mvc.HttpApplication..." # Read the transformed text from the custom template included in the package $customGlobalAsax = $project.ProjectItems | where { $_.Name -eq "Global.asax.cs.custom" } $customGlobalAsax.Open() $customGlobalAsax.Document.Activate() $customGlobalAsax.Document.Selection.SelectAll(); $replacementGlobalAsax = $customGlobalAsax.Document.Selection.Text; $customGlobalAsax.Delete() # Replace the contents of Global.asax.cs $globalAsax = $project.ProjectItems | ForEach-Object { $_.ProjectItems } | where { $_.Name -eq "Global.asax.cs" } if($globalAsax) { $globalAsax.Open() $globalAsax.Document.Activate() $globalAsax.Document.Selection.SelectAll() $globalAsax.Document.Selection.Insert($replacementGlobalAsax) $globalAsax.Document.Selection.StartOfDocument() $globalAsax.Document.Close(0) } else { Write-Host "Global.asax.cs not found -- skipping application base type update" } -
jchadwick created this gist
Mar 23, 2012 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,18 @@ param($installPath, $toolsPath, $package, $project) #### Overwrite Global.asax #### Write-Host "Overwriting Global.asax..." # Read the transformed text from the custom template included in the package $customGlobalAsax = $project.ProjectItems | where { $_.Name -eq "Global.asax.cs.custom" } $customGlobalAsax.Open() $customGlobalAsax.Document.Selection.SelectAll(); $replacementGlobalAsax = $customGlobalAsax.Document.Selection.Text; $customGlobalAsax.Delete() # Replace the contents of Global.asax.cs $globalAsax = $project.ProjectItems | ForEach-Object { $_.ProjectItems } | where { $_.Name -eq "Global.asax.cs" } $globalAsax.Open() $globalAsax.Document.Selection.SelectAll() $globalAsax.Document.Selection.Insert($replacementGlobalAsax) $globalAsax.Save()