Share via


Where is TransformXml task located?

Question

Wednesday, September 21, 2016 10:21 PM

I have a web project which i want to build using MSbuild on the build server. In my web project i have total 4 config files
web.config
web.development.config
web.staging.config
web.production.config

and solution has corresponding configurations "development","staging","production"

  

I want to use TransformXml for transforming web.config. I have created main.proj which has steps to build and transformation. The build is working fine but i am not able to Transform the config file. After the build is done I want to transform configuration files based on the configuration property which I pass as argument. Something like below

msbuild main.proj /p:Configuration=Staging

However when I run this command I get error

error MSB4036: The "TransformXml" task was not found. Check the following: 1.) The name of the task in the project file is the same as the name of the task class. 2.) The task class is "public" and implements the Microsoft.Build.Framework.ITask interface. 3.) The task is correctly declared with in the project file, or in the *.tasks files located in the "C:\Program Files (x86)\MSBuild\14.0\bin" directory.

Below is Main.proj file

<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Release</Configuration>
    <BuildOutput>$(MSBuildThisFileDirectory)BuildOutput</BuildOutput>
    <VisualStudioVersion>14.0</VisualStudioVersion>
    <Framework40Dir>C:\Windows\Microsoft.NET\Framework64\v4.0.30319</Framework40Dir>
  </PropertyGroup>


  <Target Name="Main" DependsOnTargets="Clean">
    <CallTarget Targets="BuildWeb;CreateWebConfigs;" />
  </Target>

  <Target Name="Clean">
    <RemoveDir Directories="$(BuildOutput)"/>
  </Target>

  <Target Name="BuildWeb">
    <MSBuild Projects="$(MSBuildThisFileDirectory)MyCompany.sln"
             Properties="Configuration=$(Configuration);
                         OutDir=$(BuildOutput);
                         VisualStudioVersion=$(VisualStudioVersion);
                         Framework40Dir=$(Framework40Dir)"
             Targets="Build"/>
  </Target>

  <Target Name="CreateWebConfigs">
    <TransformXml Source="$(MSBuildThisFileDirectory)Src\Api\Web.config"
                  Transform="$(MSBuildThisFileDirectory)Src\Api\Web.$(Configuration).config"
                  Destination="$(BuildOutput)\Web.config" />
  </Target>

</Project>

•I have VS 2015 Insatalled on build server
•I have .Net 4.6.2 installed on the build server

Questions

1>Where is TransformXml is located?
 >How do I refer it in main.proj file?

All replies (1)

Thursday, September 22, 2016 1:47 AM ✅Answered

Hi Lax4U,

Kindly refer link below 

http://stackoverflow.com/questions/16646698/the-transformxml-task-was-not-found-error-msb4036-on-teamcity-build

Wish can help you.

Thanks