.net-coreweb-configxdt-transformasp.net-core-cli

Web.config Transforms fail after update to .NET Core 2.1.401


Up until this morning when I updated to 2.1.401, everything was fine. I have a CI/CD process (using Jenkins) that uses CLI commands to run transforms on the generated web.config file (that .NET Core produces). The file is exactly what is generated, no changes:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <location path="." inheritInChildApplications="false">
    <system.webServer>
      <handlers>
        <add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" />
      </handlers>
      <aspNetCore processPath="dotnet" arguments=".\MyService.WebApi.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" />
    </system.webServer>
  </location>
</configuration>

Due to our server configuration, I need to add in a validation element to the system.webServer node.

Here's the transform file:

<?xml version="1.0" encoding="utf-8"?>
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
  <system.webServer>
    <validation validateIntegratedModeConfiguration="false" xdt:Transform="Insert" />
  </system.webServer>
</configuration>

It seems pretty strait forward. But now, since updating .NET Core to 2.1.401, I've encountered an error:

[dotnet-xdt] ERROR '':4:5: DotNet.Xdt.XmlNodeException: No element in the source document matches '/configuration/system.webServer/validation'

For reference, I'm using the XDT tool from the .NET Core CLI with the command:

 dotnet xdt --source .\web.config.full --transform .\web.dev.config --output .\web.config

I don't understand why that error is occuring, I'm not trying to MATCH on that element, I'm trying to INSERT the element, so of course it doesn't exist...It's NOT SUPPOSED to exist!!!

I can't seem to find anything in terms of breaking changes for 2.1.301 -> 2.1.401, and I'm spinning my wheels trying to fix all ~20 jobs that are now broken because of this.

Any insight, thoughts, pointing out possible errors, anything really would be helpful at this point!


Solution

  • There is no section /configuration/system.webServer node in the web.config.full. But there is /configuration/location/system.webServer node exist.