即使启用了自动绑定,也找不到程序集



我有一个Azure函数,由于的找不到程序集错误而失败

System.ComponentModel.Annotations, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'

这个包在我的Azure函数和具有代码的类库中都被正确引用

我在两个项目文件中都有这个

<PropertyGroup>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<GenerateBindingRedirectsOutputType>true</GenerateBindingRedirectsOutputType>
</PropertyGroup>

我该如何解决这个令人沮丧的问题?

我引用了System.ComponentModel.Annotations包

关于如何在Azure函数中进行程序集重定向,似乎没有太多内容

我在.NET Core 3.1系统中使用Azure Functions V3

Paul

这可能是因为金块的版本与生成的库的版本不匹配。您可以尝试以下操作:

1.来自包管理控制台do:

Get-Project –All | Add-BindingRedirect

在配置文件中重新生成assemblyBinding配置

2.如果没有修复,请手动添加绑定重定向。根据需要指定的版本进行更改

<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.ComponentModel.Annotations"
publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="4.1.0.0" newVersion="4.0.0.0"/>
</dependentAssembly>

oldVersion:指定最初请求的程序集的版本

newVersion:指定要使用的程序集版本

最新更新