Requirement: when developing an asp.net application, you often want to use different configurations in the debug and release environments, but the web. config file has only one
Solution: you can write the configuration in the debug environment in the original web. config, and then write the unique configuration in the release environment in web. release. config. Examples of common cases:
1. replace an attribute value of a node, and use "SetAttributes" to convert the value of "connectionString, the connectionString value of this node is used only when the "Match" Locator finds the value of "name" as "MyDB. Other attribute values that do not need to be changed are not required.
2. Replace the entire node. The "Replace" conversion replaces the entire <mermerrors> section of the web. config file. Note that because there is only one mermerrors section under the <system. web> node, the "xdt: Locator" feature is not required.
3. delete an attribute of a node and use RemoveAttributes. Delete the debug attribute of the compilation node.
The above tests are available.
Summary: through the web. release. config or web. debug. you can search for and replace node content in the specified format in config to implement web. config generates different versions based on different production environments to facilitate debugging and release.