Azure 网站部署失败 - 发现同一依赖程序集的不同版本之间存在冲突

Azure websites deployment fail - found conflicts between different versions of the same dependent assembly

我的 Azure 网站部署失败。在我的本地机器上一切正常:当在 Visual Studio 的输出 window 中将日志详细程度设置为详细时,我看不到任何问题或冲突。

但我不知道如何在尝试部署到 Azure 时查看日志并修复 Kudu 中的以下错误:

命令:"D:\home\site\deployments\tools\deploy.cmd" 处理 .NET Web 应用程序部署。 MSBuild 自动检测:使用来自 'D:\Program Files (x86)\MSBuild.0\bin\amd64' 的 msbuild 版本“14.0”。 packages.config 中列出的所有软件包都已安装。 MyProject.Broadbean -> D:\home\site\repository\MyProject.Broadbean\bin\Release\MyProject.Broadbean.dll MyProject.Domain -> D:\home\site\repository\MyProject.Domain\bin\Release\MyProject.Domain.dll MyProject.Mandrill -> D:\home\site\repository\Mandrill\bin\Release\MyProject.Mandrill.dll D:\Program Files (x86)\MSBuild.0\bin\Microsoft.Common.CurrentVersion.targets(1819,5):警告 MSB3277:发现同一依赖程序集的不同版本之间存在无法解决的冲突。当日志详细程度设置为详细时,这些引用冲突会列在构建日志中。 [D:\home\site\repository\MyProject.WebUI\MyProject.WebUI.csproj] D:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\TypeScript\Microsoft.TypeScript.targets(242,5):警告:未指定编译器日志,'Clean' 将不起作用。 [D:\home\site\repository\MyProject.WebUI\MyProject.WebUI.csproj] CSC:错误 CS1703:已导入具有等效标识的多个程序集:'D:\home\site\repository\packages\System.Xml.ReaderWriter.4.3.1\lib\net46\System.Xml.ReaderWriter.dll' 和 'D:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.6.1\Facades\System.Xml.ReaderWriter.dll'。删除其中一个重复引用。 [D:\home\site\repository\MyProject.WebUI\MyProject.WebUI.csproj] CSC:错误 CS1703:已导入具有等效标识的多个程序集:'D:\home\site\repository\packages\System.ComponentModel.Annotations.4.5.0\lib\net461\System.ComponentModel.Annotations.dll' 和 'D:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.6.1\Facades\System.ComponentModel.Annotations.dll'。删除其中一个重复引用。 [D:\home\site\repository\MyProject.WebUI\MyProject.WebUI.csproj] 失败 exitCode=1,命令="D:\Program Files (x86)\MSBuild.0\Bin\MSBuild.exe" "D:\home\site\repository\MyProject.WebUI\MyProject.WebUI.csproj" /nologo /verbosity:m /t:Build /t:pipelinePreDeployCopyAllFilesToOneFolder /p:_PackageTempDir="D:\local\Tempd69b9dee0afc5a";AutoParameterizationWebConfigConnectionStrings=false;Configuration=Release; UseSharedCompilation=false /p:SolutionDir="D:\home\site\repository.\" 网站部署期间发生错误。 \r\nD:\Program Files (x86)\SiteExtensions\Kudu.20129.3767\bin\Scripts\starter.cmd "D:\home\site\deployments\tools\deploy.cmd"

如何在 Kudu 或 Azure 网站环境中查看此构建日志并修复这些错误?我显然错过了一些东西。背景是我更新了很多 nuget 包,站点现在在部署时中断,我不太清楚如何修复它。

请在您认为可能导致构建失败的每个步骤中使用登录调试您deploy.cmd。 似乎由于项目中的 nuget 更新,同一依赖程序集的不同版本之间存在冲突。请查看您已升级的程序集并检查它们在您的项目中的兼容性。

我相信你一定是运行你的构建使用了一些构建代理,如果你有权访问构建代理并登录到 VM 并尝试调试你的 cmd 文件。

此外,请在您的 Agent VM 中复制并安装与您本地相同的环境,大多数情况下,这是构建失败的原因。

希望对您有所帮助。

为了修复 "Multiple assemblies with equivalent identity have been imported. Remove one of the duplicate references." 错误,我删除了这些程序集的引用。

这让我可以部署。但是在部署时,由于不同程序集之间的冲突,我得到了错误屏幕。

为了修复 "Found conflicts between different versions of the same dependent assembly that could not be resolved." 冲突,我删除了 web.config 文件中有问题程序集的绑定重定向。

它想表达什么

.net framework 本身就有System.Xml.ReaderWriter.dll 所以你不用单独添加。 请从您的项目中删除对 System.Xml.ReaderWriter.dll 的任何引用。 同样,您必须为其他程序集执行此操作。