I have an MVC project that is targeting .NETCoreApp 1.1. When I publish the project, a web.config file is created for me. I want the created web.config to contain a few rewrite rules.
I've tried adding a web.config file to the project root, but every publish attempt contains the same generic, mostly empty configuration file. Where/how do I get the publish process to include a web.config that contains my extra information?
Edit:
It looks like this may not be an issue with dotnet core's publish. This may be an issue to how I've configured my TeamCity build.
dotnet publish .\{{projectName}}.csproj --configuration Staging --output C:\new-output-dir\@Dmitry's comment lead me down the right path.
I hopped into TeamCity's build logs to see what command was being executed to publish my app. It looked similar to:
dotnet publish .\{{projectName}}.csproj --configuration Staging --output C:\new-output-dir\
TeamCity was re-using the output directory for each build, and by default the previous web.configs that had been generated weren't being overwritten with the new one that contained the rewrite rules.
Two possible solutions:
dotnet clean command Resources for learning more:
dotnet publish documentationdotnet publish commandIf you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With