I need to add the following to my published web.config;
<modules runAllManagedModulesForAllRequests="false">
<remove name="WebDAVModule" />
</modules>
that I am publishing with Asp.Net Core 2, however, it doesnt seem to be working;
$webConfig = (Get-Item -Path ".\").FullName + "\Bemfeito.Services.WebApi\obj\Release\netcoreapp2.0\PubTmp\Out\web.config"
$doc = (gc $webConfig) -as [Xml]
$moduleNode = $doc.CreateElement("modules")
$moduleNode.SetAttribute("runAllManagedModulesForAllRequests", "false")
$removeNode = $moduleNode.CreateElement("remove")
$removeNode.SetAttribute("name","WebDAVModule")
$moduleNode.AppendChild($removeNode)
$doc.configuration.system.webServer.AppendChild($moduleNode)
$doc.Save($webConfig)
(I am adding this as a prepublish option on my webdeploy) I think it has something to do with not grabbing and/or commiting the saves correctly? can someone please advise me on where I am going wrong?
gc web.config,get-content web.config,gc "$pwd\web.config",Resolve-Path "web.config"andResolve-Path web.config(the web.config is in the same directory as a test when i run the script) Also I am using Visual Studio powershell tools i.e. right click and execute script on the .ps1 fileC:\\.....\web.configthis works? any idea on using the current working directory?