Skip to content

How it works

Sergey Zwezdin edited this page Jun 18, 2016 · 2 revisions

The main idea of Magic Chunks is to represent all config transformations as a key-value collection.

The key contains path at source file which should be modified. And the value contains data for this path in modified file.

Let's take a look on typical ASP.NET web.config file:

<configuration>
  <system.web>
    <compilation debug="true" targetFramework="4.5.1" />
    <authentication mode="None" />
  </system.web>
</configuration>

To transform some nodes or attributes you should specify path to this item and value for that, for example:

  • configuration/system.web/compilation/@debugfalse
  • configuration/system.web/authentication/@modeForms

After applying these transformations you'll have:

<configuration>
  <system.web>
    <compilation debug="false" targetFramework="4.5.1" />
    <authentication mode="Forms" />
  </system.web>
</configuration>

Note that / symbol used as separator between parts of the path.

If target node isn't represent in source file, Magic Chunks will create new node and put value there.