tfsbuildalm

TFS Builds failing to find _PublishedWebsites/Web.Config


After moving source to a different collection (one team project for all files), and manually re-creating the builds I am getting the following build error.

C:\b\1\1\src\Src\Case\Case.UI\Case.UI.csproj(803,5): error : Could not write Destination file: Could not find a part of the path 'C:\b\1\1\src\Src\Case\Case.UI\bin\_PublishedWebsites\Case.UI\Web.config'.

This only applies when using the MS-Build args:

/p:DeployOnBuild=True /p:TransformConfigFiles=True

The line in question is 'apparently' to do with Web.config transforms (Which we do require), and links back to the project file here:

<TransformXml Source="Web.config" Transform="$(ProjectConfigTransformFileName)" Destination="$(WebProjectOutputDir)\Web.config" />


Solution

  • The problem is MSBUILD attempting to transform your config files in the wrong directory.

    Remove the argument /p:TransformConfigFiles=True and just have it set to do the transform in the solution itself.