Revert web.config file to previous one after build?

I had a problem with my file web.configin Visual Studio 2015. I open the project, open the file web.configand update the connection string to point to a different database source. I save the changes and close the file web.config. If I open the file backup web.config, the updates that I made still exist. But after creating the assembly, if I open the file web.config, my update returned to what it was before. Any ideas why?

+4
source share
1 answer

I had the same problem. Turns out there was a modification to the default setting in my .csproj file ...

<Target Name="BeforeBuild">
    <TransformXml Source="Web.Template.config" Transform="Web.$(Configuration).config" Destination="Web.config" />
</Target>

web.config Web.debug.config, Web.release.config ..

: http://www.kongsli.net/2012/01/13/enabling-web-transforms-when-debugging-asp-net-apps/

+2

Source: https://habr.com/ru/post/1656957/


All Articles