-
-
Save Balder1840/868cd9175a74aa87dc921101233b9aa3 to your computer and use it in GitHub Desktop.
NuGet install.ps1 script that overwrites existing file
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 characters
| 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" | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment