-
Notifications
You must be signed in to change notification settings - Fork 46
MSBuild
Sergey Zwezdin edited this page Jun 18, 2016
·
4 revisions
Magic Chunks have integrated build task for MSBuild projects. To use it download latest release manually or get it directly from Nuget.
Steps to setup config transformations at MSBuild project:
Step 1: Import MagicChunks.targets into your msbuild file.
<Import Project="tools\MagicChunks.targets" />Step 2: Define transformation collection. For this purpose you have to use ItemGroup element. For instance, to define collection named TransformsXml you need to write such piece of code:
<ItemGroup>
<TransformsXml Include="configuration/system.web/authentication/@mode">
<Value>Forms</Value>
</TransformsXml>
<TransformsXml Include="configuration/system.web/httpRuntime">
<Value>125</Value>
</TransformsXml>
...
</ItemGroup>Step 3: Run TransformConfig task:
<TransformConfig Path="Web.config" Trasformations="@(TransformsXml)" />TransformConfig task have following parameters:
-
Path− path to source file. -
Target− path to target file (default value: same asPathparameter). -
Type− type of document:Xml,Json,Yamland so on (default value:auto- library will detect document type automatically). -
Trasformations− key-valued collection of transformations.
You can find complete sample msbuild script here.