gpt4 book ai didi

c# - TransformXml 任务在 linux 上使用 mono 通过 msbuild 失败

转载 作者:太空狗 更新时间:2023-10-29 20:02:28 36 4
gpt4 key购买 nike

按照 this answer 中的步骤操作后,当尝试通过单声道构建项目时(使用 msbuild),出现以下错误:

(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 上,此文件不存在。要解决此问题,请按照下列步骤操作:

  1. 安装 nuget 包 MSBuild.Microsoft.VisualStudio.Web.targets
  2. 右键单击您的项目,然后单击“卸载项目”
  3. 右键单击您的(现已卸载的)项目,然后单击“编辑 MyProjectName.csproj”
  4. 替换这一行:
<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 中的版本名称更新为必要的):

<UsingTask TaskName="TransformXml" AssemblyFile="..\packages\MSBuild.Microsoft.VisualStudio.Web.targets.14.0.0.3\tools\VSToolsPath\Web\Microsoft.Web.Publishing.Tasks.dll" />
  1. 重新加载您的项目,瞧,在 Linux 上构建工作!

关于c# - TransformXml 任务在 linux 上使用 mono 通过 msbuild 失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45097944/

36 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com