使用Mono在Linux上通过msbuild进行TransformXml任务失败 [英] TransformXml task fails via msbuild on linux using mono
问题描述
按照此答案中的步骤进行操作之后,尝试通过mono(使用msbuild)构建项目时,我得到了以下错误:
After following the steps in this answer, when attempting to build a project through mono (Using msbuild), I get the following error:
(AfterCompile目标)-> project.csproj(469,5):错误MSB4062:无法从程序集/usr/lib/mono/xbuild/Microsoft/VisualStudio/v15.0/Web/Microsoft.Web.Publishing.Tasks中加载"TransformXml"任务.dll.确认声明正确无误,并且该程序集及其所有依赖项均可用,并且该任务包含实现Microsoft.Build.Framework.ITask的公共类.
(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.
显示为Microsoft.Web.Publishing.Tasks.dll
不可用.
推荐答案
在Linux上通过mono,该文件不存在.要解决此问题,请按照下列步骤操作:
On linux via mono, this file doesn't exist. To solve this issue, follow these steps:
- 安装nuget包MSBuild.Microsoft.VisualStudio.Web.targets
- 右键单击您的项目,然后单击卸载项目"
- 右键单击您(现在已卸载)的项目,然后单击编辑MyProjectName.csproj"
- 替换此行:
<UsingTask TaskName="TransformXml" AssemblyFile="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v$(VisualStudioVersion)\Web\Microsoft.Web.Publishing.Tasks.dll" />
使用更新的nuget Microsoft.Web.Publishing.Tasks.dll
位置(必要时更新MSBuild.Microsoft.VisualStudio.Web.targets.14.0.0.3
中的版本名称):
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" />
- 重新加载您的项目,瞧,在linux上工作!
这篇关于使用Mono在Linux上通过msbuild进行TransformXml任务失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!