asp.net-web-apiweb.config-transform

Web.config transformation does not take web.debug.config but uses default


dotnet publish seems not to take the existing web.debug.config.

Steps

I have played around with <CopyToOutputDirectory>Never</CopyToOutputDirectory> and <CopyToPublishDirectory>Never</CopyToPublishDirectory> resulting the file beeing copied or not, but without effect on the actual content of web.config.

What am I missing or is my expectation among Transforming Web.config wrong?
https://learn.microsoft.com/en-us/aspnet/core/host-and-deploy/iis/transform-webconfig?view=aspnetcore-7.0


Solution

  • My assumption was wrong:
    a web.debug.config does not replace the web.config but transform it using the xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform" namespace and later its Locator and Transform attributes.