7

After following the steps in this answer, when attempting to build a project through mono (Using msbuild), I get the following error:

(AfterCompile target) -> project.csproj(469,5): error MSB4062: The "TransformXml" task could not be loaded from the assembly /usr/lib/mono/xbuild/Microsoft/VisualStudio/v15.0/Web/Microsoft.Web.Publishing.Tasks.dll. 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.

It appears as if Microsoft.Web.Publishing.Tasks.dll is unavailable.

1 Answer 1

15

On linux via mono, this file doesn't exist. To solve this issue, follow these steps:

  1. Install the nuget package MSBuild.Microsoft.VisualStudio.Web.targets
  2. Right click your project, and click "Unload Project"
  3. Right click your (now unloaded) project, and click "Edit MyProjectName.csproj"
  4. Replace this line:
<UsingTask TaskName="TransformXml" AssemblyFile="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v$(VisualStudioVersion)\Web\Microsoft.Web.Publishing.Tasks.dll" />

With your updated nuget Microsoft.Web.Publishing.Tasks.dll location (Update version name in MSBuild.Microsoft.VisualStudio.Web.targets.14.0.0.3 as necessary):

<UsingTask TaskName="TransformXml" AssemblyFile="..\packages\MSBuild.Microsoft.VisualStudio.Web.targets.14.0.0.3\tools\VSToolsPath\Web\Microsoft.Web.Publishing.Tasks.dll" />
  1. Reload your project, and voila, working build on linux!
Sign up to request clarification or add additional context in comments.

3 Comments

This solution was my rescue more than 3 years later, thank you so much!
I had to add <UsingTask TaskName="TransformXml" AssemblyFile="..\packages\MSBuild.Microsoft.VisualStudio.Web.targets.14.0.0.3\tools\VSToolsPath\Web\Microsoft.Web.Publishing.Tasks.dll" /> to .csproj as it was not present yet.
This worked for me on OSX except that I had to drop the initial ..\ from the AssemblyFile property, so <UsingTask TaskName="TransformXml" AssemblyFile="packages\MSBuild.Microsoft.VisualStudio.Web.targets.14.0.0.3\tools\VSToolsPath\Web\Microsoft.Web.Publishing.Tasks.dll" />

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.