Short Answer - Explicitly Import
What I had to do:
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v12.0\Web\Microsoft.Web.Publishing.targets" Condition="!Exists('$(VSToolsPath)\Web\Microsoft.Web.Publishing.targets')" />
Long Answer
When you do File -> New Web Project in VS2013 you get the following inside your *.csproj file:
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
</PropertyGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<Import Project="$(VSToolsPath)\WebApplications\Microsoft.WebApplication.targets" Condition="'$(VSToolsPath)' != ''" />
The $(VisualStudioVersion)
always evaluated to 11.0
for me on build machines and on multiple development machines. Even on machines with VS2013, which is 12.0
.
Diving into that I found that in the Microsoft.WebApplication.targets
from above, it has a line to import the file we really want Microsoft.Web.Publishing.targets
only if it exists like so on line 377:
<!--Import publishing target-->
<Import Project="..\Web\Microsoft.Web.Publishing.targets" Condition="Exists('..\Web\Microsoft.Web.Publishing.targets')" />
So to me this is an implicit import of Microsoft.Web.Publishing.targets
.
The problem is that if this file doesn't exist, it does nothing and you do not know about it until you get the error when trying to use the TransformXml
task.
Installing VS2013 did not install Microsoft.Web.Publishing.targets
in the 11.0
directory. It did install it in the 12.0
directory. I'm guessing if I installed VS2012, it would do it.
In any case, I was able to solve it by explicitly importing Microsoft.Web.Publishing.targets
from the 12.0
directory if it didn't exist and wasn't implicitly imported by Microsoft.WebApplication.targets
like so:
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v12.0\Web\Microsoft.Web.Publishing.targets" Condition="!Exists('$(VSToolsPath)\Web\Microsoft.Web.Publishing.targets')" />