How to configure Web.Config conversion to support local and production configurations?

I have this dilemma for having various connection strings for web.config on my local computer and having a release conversion that would make production binaries using machine.config on the web server.

So, I have these files in my Visual Studio solution:

Web.Config Web.Debug.Config Web.Release.Config

In web.config, I deleted and added new connection strings.

<remove name="connstring">
<add name="connstring" ConnectionString="blahblah" />

What I want to do is to have nothing in the final web.config when deploying (using the TFS build) to the web server so that my web application uses anything in the machine.config file on the server.

How can i do this?

+4
source share
1

RemoveAll. , Release, web.config, Web.Release.Config:

<?xml version="1.0" encoding="utf-8"?>
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform" xdt:Transform="RemoveAll" />

web.config XML .

, RemoveAll transform , . , Web.Release.Config :

<?xml version="1.0" encoding="utf-8"?>
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
  <appSettings xdt:Transform="RemoveAll" />
</configuration>

. .

0

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


All Articles