In project file, Add following section. First add build project from 2010.
<!-- ***** SECTION BELOW ADDED IN ORDER TO USE WEB.CONFIG TRANSFORMS ***** -->
<UsingTask TaskName="TransformXml" AssemblyFile="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\Web\Microsoft.Web.Publishing.Tasks.dll" />
<!-- TRANSFORMS WEB.CONFIG FROM WEB.DEV.CONFIG -->
<Target Name="TransformDEVConfigFile" AfterTargets="AfterBuild" Condition="'$(TransformDEVConfigFile)'=='true'">
<ItemGroup>
<DeleteAfterBuild Include="$(WebProjectOutputDir)\Publish\DEV\Web.*.config" />
</ItemGroup>
<!-- ProjectConfigTransformDEVFileName IS A MSBUILD PARAMETER IN THE BUILD DEFINITION -->
<TransformXml Source="Web.config" Transform="$(ProjectConfigTransformDEVFileName)" Destination="$(WebProjectOutputDir)\Publish\DEV\Web.config" />
<Copy SourceFiles="$(WebProjectOutputDir)\Publish\DEV\Web.config" DestinationFolder="$(WebProjectOutputDir)"></Copy>
<Delete Files="@(DeleteAfterBuild)" />
</Target>
<!-- TRANSFORMS WEB.CONFIG FROM WEB.QA.CONFIG -->
<Target Name="TransformQAConfigFile" AfterTargets="AfterBuild" Condition="'$(TransformQAConfigFile)'=='true'">
<ItemGroup>
<DeleteAfterBuild Include="$(WebProjectOutputDir)\Publish\QA\Web.*.config" />
</ItemGroup>
<!-- ProjectConfigTransformQAFileName IS A MSBUILD PARAMETER IN THE BUILD DEFINITION -->
<TransformXml Source="Web.config" Transform="$(ProjectConfigTransformQAFileName)" Destination="$(WebProjectOutputDir)\Publish\QA\Web.config" />
<Delete Files="@(DeleteAfterBuild)" />
</Target>
<!-- TRANSFORMS WEB.CONFIG FROM WEB.PROD.CONFIG -->
<Target Name="TransformPRODConfigFile" AfterTargets="AfterBuild" Condition="'$(TransformPRODConfigFile)'=='true'">
<ItemGroup>
<DeleteAfterBuild Include="$(WebProjectOutputDir)\Publish\PROD\Web.*.config" />
</ItemGroup>
<!-- ProjectConfigTransformPRODFileName IS A MSBUILD PARAMETER IN THE BUILD DEFINITION -->
<TransformXml Source="Web.config" Transform="$(ProjectConfigTransformPRODFileName)" Destination="$(WebProjectOutputDir)\Publish\PROD\Web.config" />
<Delete Files="@(DeleteAfterBuild)" />
</Target>
In Web.config, the connectionStrings section will be replace in the transformation web config
<connectionStrings> <add name="VentureEntities" connectionString="metadata=res://*/Models.VentureModel.csdl|res://*/Models.VentureModel.ssdl|res://*/Models.VentureModel.msl;provider=System.Data.SqlClient;provider connection string="data source=yoursqlserver; initial catalog=yourdatabase; integrated security=True;multipleactiveresultsets=True;application name=EntityFramework"" providerName="System.Data.EntityClient" /> </connectionStrings>
In Web.DEV.config, the connectionStrings will replace the one in web.config
<connectionStrings xdt:Transform="Replace"> <add name="VentureEntities" connectionString="metadata=res://*/Models.VentureModel.csdl|res://*/Models.VentureModel.ssdl|res://*/Models.VentureModel.msl;provider=System.Data.SqlClient;provider connection string="data source=yourDEVsqlserver; initial catalog=yourDEVdatabase; integrated security=True;multipleactiveresultsets=True;application name=EntityFramework""
providerName="System.Data.EntityClient" /></connectionStrings>
In Process->Build process paraemters->Advanced
Add /p:TransformDEVConfigFile=true /p:TransformQAConfigFile=true /p:TransformPRODConfigFile=false /p:ProjectConfigTransformDEVFileName="Web.DEV.config" /p:ProjectConfigTransformQAFileName="Web.QA.config" /p:ProjectConfigTransformPRODFileName="Web.PROD.config"