TransformXml task is done using msbuild on linux using mono

After completing the steps in this answer, when I try to create a project through mono (using msbuild), I get the following error:

(AfterCompile target) β†’ project.csproj (469.5): error MSB4062: task "TransformXml" could not be loaded from assembly / usr / lib / mono / xbuild / Microsoft / VisualStudio / v 15.0 / Web / Microsoft.Web.Publishing .Tasks.dll. Ensure that the declaration is correct, that the assembly and all its dependencies are available, and that the task contains an open class that implements Microsoft.Build.Framework.ITask.

It seems that Microsoft.Web.Publishing.Tasks.dll not available.

+3
source share
1 answer

In linux via mono this file does not exist. To resolve this issue, follow these steps:

  • Install nuget package MSBuild.Microsoft.VisualStudio.Web.targets
  • Right-click your project and click Upload Project
  • Right-click on your (now uploaded) project and click on "Edit MyProjectName.csproj"
  • Replace this line:
 <UsingTask TaskName="TransformXml" AssemblyFile="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v$(VisualStudioVersion)\Web\Microsoft.Web.Publishing.Tasks.dll" /> 

With the updated location nuget Microsoft.Web.Publishing.Tasks.dll (if necessary, update the version name in MSBuild.Microsoft.VisualStudio.Web.targets.14.0.0.3 ):

 <UsingTask TaskName="TransformXml" AssemblyFile="..\packages\MSBuild.Microsoft.VisualStudio.Web.targets.14.0.0.3\tools\VSToolsPath\Web\Microsoft.Web.Publishing.Tasks.dll" /> 
  1. Restart your project, and voila, working on linux!
+7
source

Source: https://habr.com/ru/post/1390833/


All Articles