I had a small problem that the web.config of the eTender Messenger was overwritten with every new dotnet publish command. Because of this, we had to take care to exclude the published config with every deployment to production. The solution was very simple, but took some researching on the internet. You can add the following MS Build property to your csproj to prevent overwriting your web.config:
In this aspnet github issue the setting is confusingly called IsWebConfigTransformEnabled, but in my setup (Visual Studio Code on OSX, .net core 2.0) adding this property does not work and I had to use IsTransformWebConfigDisabled ;-).