The following is the solution that addressed this problem. While setting up a project for TFS build, I came across issues with the build system not transforming my web.config to different configurations. i.e. I want my web.config to be transformed with web.config.release upon build/publish.
I found the following solution that worked for me.
Within Visual Studio, unload the web project (in this case I am working with a web application), scroll to the bottom and add the following task. On the build server you can ensure that the path is valid and it is referencing the most appropriate version. The UsingTask imports the TransformXml method from Microsoft.Web.Publishing.Tasks.dll
<UsingTask TaskName="TransformXml" AssemblyFile="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v14.0\Web\Microsoft.Web.Publishing.Tasks.dll" />
<Target Name="ApplyTransform" Condition="Exists('Web.$(Configuration).config')">
<TransformXml Source="web.config" Transform="Web.$(Configuration).config" Destination="Web.config" />
Then within the BeforeBuild Target add
<Exec Command="attrib -r Web.config" />
<CallTarget Targets="ApplyTransform" />
Exec removes the read-only attribute from the web.config file and the CallTarget will ApplyTransform target