c# - 即使启用了自动绑定,也找不到程序集
问题描述
我有一个失败的 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
保罗
解决方案
可能是因为 nugget 的版本与生成的库的版本不匹配。您可以尝试以下方法:
1.从包管理控制台做:
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:指定要使用的程序集版本
推荐阅读
- javascript - 如何在 angular 10 或 angular 8 中使用 angular-gantt(angularjs 库)
- firebase - Flutter - 如何集成自动推送通知
- r - R - 如何执行 X 行 - Y 行
- reactjs - 使用 Framer 运动 useViewportScroll 和 scrollY 与 react-intersection-observer
- database-connection - 错误连接数据库mysql到spring boot(STS)
- javascript - mongodb动态位置运算符
- excel - 使用 excel 宏从网站上的图表中读取值
- list - Haskell - 尝试将字符串分解为特定字符集的字符串列表
- python-3.x - 在 gitlab graphql 中访问时间日志时出错
- javascript - 如何使我的文本截断以进行持续响应?