0
votes

Hi I have a bunch of csproj visual studio projects. These includedes alot of slowcheetah transformation files and alot of normal c# code files.

In order to optimize my build process, I would like to build these projects with "some flag" to msbuild, that will only transform the slowcheetah config files - and not build the dll and perform other build operations.

Anyone knows how to msbuild only the clowcheetah transformations?

1

1 Answers

2
votes

Anyone knows how to msbuild only the clowcheetah transformations?

You can use the MSBuild task TransformXml to transform config files:

<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Demo" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

<UsingTask TaskName="TransformXml"
      AssemblyFile="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v12.0\Web\Microsoft.Web.Publishing.Tasks.dll" />

<Target Name="AfterBuild">
  <TransformXml Source="Config\App.config"
                Transform="Config\App.$(Configuration).config"
                Destination="$(OutputPath)\$(AssemblyName).$(OutputType).config" />
</Target>

With this task, MSBuild will transform the config based on the configuration. But since you are have a lot of config files for a bunch of csproj visual studio projects, so transform multiple config files for multiple projects should be your real issue.

To resolve this issue, you can create one target to list all the config files that need to be transformed, then another for the actual transforms. For some more detailes, please refer to the Danny`s question and answer:

Transforming multiple config files for multiple projects via MsBuildProj file

Hope this helps.