dotnet publish seems not to take the existing web.debug.config.
Steps
- Created a new project in VS 2022 (17.6.2), using 'ASP .NET Core Web API' as project template.
- Did a
dotnet publishfrom CLI and grabbed the defaultweb.configfrom publish folder. - Then added a
web.debug.configwith same content as the default to the project root. - Within
web.debug.config, added timeout value<aspNetCore requestTimeout="00:02:00" .... - When I do a
dotnet publishagain, theweb.debug.configgets copied to the publish folder, defaultweb.configis still there. - I would expect that there is a
web.configwith the content from my ownweb.debug.config.
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
My assumption was wrong:
a
web.debug.configdoes not replace theweb.configbut transform it using thexmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform"namespace and later itsLocatorandTransformattributes.