Last active
March 13, 2017 18:47
-
-
Save patrickperrone/dfb89efe783471e56c8de6d9fe3c975b to your computer and use it in GitHub Desktop.
Uninstall Nancy implementation of Sitecore.Ship
This file contains 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
# uninstall Nancy version of Sitecore.Ship | |
$websitePath = "C:\inetpub\SIM\shipNancy\Website" | |
if (!(Test-Path $websitePath)) | |
{ | |
Write-Host "Cannot find the path $($websitePath)" | |
return | |
} | |
# Delete ship.config file | |
$configPath = Join-Path $websitePath -ChildPath "App_Config\Include\ship.config" | |
if (Test-Path $configPath) | |
{ | |
Write-Host "Deleting ship.config file." | |
Remove-Item -Path $configPath | |
} | |
# Delete web.config entries | |
Write-Host "Deleting Sitecore.Ship entries from web.config." | |
$configPath = Join-Path $websitePath -ChildPath "web.config" | |
$xml = [xml](Get-Content $configPath) | |
# Remove configSections | |
$node = $xml.configuration.SelectSingleNode("configSections/section[@name='packageInstallation']") | |
$node.ParentNode.RemoveChild($node) | Out-Null | |
$node = $xml.configuration.SelectSingleNode("configSections/section[@name='nancyFx']") | |
$node.ParentNode.RemoveChild($node) | Out-Null | |
# Remove packageInstallation | |
$node = $xml.configuration.SelectSingleNode("packageInstallation") | |
$node.ParentNode.RemoveChild($node) | Out-Null | |
# Remove nancyFx | |
$node = $xml.configuration.SelectSingleNode("nancyFx") | |
$node.ParentNode.RemoveChild($node) | Out-Null | |
# Remove NancyHttpRequestHandler | |
$node = $xml.configuration.SelectSingleNode("system.web/httpHandlers/add[@type='Nancy.Hosting.Aspnet.NancyHttpRequestHandler']") | |
$node.ParentNode.RemoveChild($node) | Out-Null | |
$node = $xml.configuration.SelectSingleNode("system.webServer/handlers/remove[@name='Nancy']") | |
$node.ParentNode.RemoveChild($node) | Out-Null | |
$node = $xml.configuration.SelectSingleNode("system.webServer/handlers/add[@name='Nancy']") | |
$node.ParentNode.RemoveChild($node) | Out-Null | |
# Remove assembly binding redirect | |
$nodes = $xml.configuration.runtime.assemblyBinding.dependentAssembly | |
write-host "node count: $($nodes.Count)" | |
$nodes | % { | |
if ($_.assemblyIdentity.Attributes['name'].'#text' -eq "Antlr3.Runtime") | |
{ | |
$_.ParentNode.RemoveChild($_) | Out-Null | |
} | |
} | |
Write-Host "Saving changes to Web.config" | |
$xml.Save($configPath) | |
# Delete Assemblies | |
Write-Host "Deleting Sitecore.Ship assemblies." | |
$binPath = Join-Path $websitePath -ChildPath "bin" | |
Remove-Item -Path (Join-Path $binPath -ChildPath "Nancy*.dll") | |
Remove-Item -Path (Join-Path $binPath -ChildPath "Sitecore.Ship*.dll") | |
Write-Host "Sitecore.Ship is uninstalled." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment