TransformXml task could not be loaded from Microsoft.Web.Publishing.Tasks.dll
Has anyone seen this error and know how to fix it?
The "TransformXml" task could not be loaded from the assembly C:Program Files (x86)MSBuildMicrosoftVisualStudiov11.0WebMicrosoft.Web.Publishing.Tasks.dll.
Could not load file or assembly 'file:///C:Program Files (x86)MSBuildMicrosoftVisualStudiov11.0WebMicrosoft.Web.Publishing.Tasks.dll' or one of its dependencies. The system cannot find the file specified.
Confirm that the declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask.
I read elsewhere that the problem is when you don't have SQL Server installed. But I do have SQL Express 2012 x64 installed with SP1. I am also running VS 2013 Professional.
I have ran this exact same solution in VS 2012 express with no problems.
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:
<Import Project="$(MSBuildExtensionsPath)MicrosoftVisualStudiov10.0WebMicrosoft.Web.Publishing.targets" />
<Import Project="$(MSBuildExtensionsPath)MicrosoftVisualStudiov$(VisualStudioVersion)WebMicrosoft.Web.Publishing.targets" />
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.
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)MSBuildMicrosoftVisualStudiov12.0WebMicrosoft.Web.Publishing.Tasks.dll
C:Program Files (x86)MSBuildMicrosoftVisualStudiov12.0WebMicrosoft.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.
链接地址: http://www.djcxy.com/p/85088.html