TransformXml task could not be loaded from Microsoft.Web.Publishing.Tasks.dll

The answers provided by Dai Bok and emalamisura work fine as long as you use Visual Studio 2012. For VS 2013 this fails as well. In order to make this work with all versions of Visual Studio you should:

  • Open the project file (.csproj) of the project failing to load
  • Search for <Import Project="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v10.0\Web\Microsoft.Web.Publishing.targets" />
  • Change it to <Import Project="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v$(VisualStudioVersion)\Web\Microsoft.Web.Publishing.targets" />
  • Reload the project

That will set the correct version of Visual Studio dynamically and properly.


To get mine to work, I just copied my v10.0 folder and renamed it to v11.0, and things seems to work well from then on. That's the quick fix for now.

As this is probably not the best solution, and although it works, I was going to try installing the Microsoft Windows SDK for Windows 7 and .NET Framework 4 Windows SDK for Windows 7 and .NET Framework 4, but it is taking to long to download.


To fix the issue,

  1. Find the Visual studio Installer in your computer
  2. Click or tap to start the installer, and then select Modify.
  3. From the Individual Components screen, select Asp.net and web development tools and then select Modify/Install.

This solved the issue as it creates the dll's in the mentioned path.


I've been combating this problem on our build server for several days, so I figured I'd document the resolution I came to. First, my build server has the web publishing extensions installed. I can use the TransformXml task to my heart's content inside of a web application project.

To use it outside of a web application project, I tried to add the UsingTask element to my project and point it to the right place using ms build properties (as Benjamin demonstrated). However, they weren't there on my build server (those with easy access to the file system of their build server can probably skip this and just install the relevant package to Visual Studio). I even went so far as to hard code visual studio versions, but it always dropped that error on me.

I finally gave up, pulled the DLLs from my local PC:

C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v12.0\Web\Microsoft.Web.Publishing.Tasks.dll
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v12.0\Web\Microsoft.Web.XmlTransform.dll

I uploaded them to source control and added that folder to my build's workspace (Edit Build Definition -> Source Settings -> Source Control Folder). From there, I don't even need to reference the folder -- here's what my UsingTask looks like:

  <UsingTask TaskName="TransformXml" AssemblyFile="Microsoft.Web.Publishing.Tasks.dll" />

Now I can use the TransformXml task to my heart's content from any project.