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

后端 未结 10 2184
醉话见心
醉话见心 2020-12-13 05:35

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)\\MSBuild\\M

相关标签:
10条回答
  • 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.

    0 讨论(0)
  • 2020-12-13 05:54

    For VS2019

    <UsingTask TaskName="TransformXml" AssemblyFile="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(MSBuildToolsVersion
    

    I replaced MSBuildToolsVersion with VisualStudioVersion.

    0 讨论(0)
  • 2020-12-13 05:55

    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.

    0 讨论(0)
  • 2020-12-13 06:00

    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.

    0 讨论(0)
  • 2020-12-13 06:00

    Because there are only v12.0, v14.0 and v15.0 in my VisualStudio folder, I edit my project file and change the reference path from v10.0 to v14.0. Then the project builds successfully.

    Before:

    <UsingTask TaskName="TransformXml" AssemblyFile="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v10.0\Web\Microsoft.Web.Publishing.Tasks.dll" />
    

    After:

    <UsingTask TaskName="TransformXml" AssemblyFile="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v14.0\Web\Microsoft.Web.Publishing.Tasks.dll" />
    
    0 讨论(0)
  • 2020-12-13 06:04

    The correct answer to this is to unload the project in question and then edit the csproj file, look for an entry where they are referencing the 10.0 path and change it to point to 11.0 instead.

    0 讨论(0)
提交回复
热议问题