即使启用自动绑定也找不到程序集
Assembly not found even when automatic binding is enabled
我有一个 Azure 函数失败,并出现找不到
的程序集错误
System.ComponentModel.Annotations, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
我的 Azure 函数和具有代码
的 class 库中都正确引用了此包
我在两个项目文件中都有这个
<PropertyGroup>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<GenerateBindingRedirectsOutputType>true</GenerateBindingRedirectsOutputType>
</PropertyGroup>
我该如何解决这个非常令人沮丧的问题?
我引用了System.ComponentModel.Annotations包
似乎没有太多关于如何在 Azure 函数中进行程序集重定向的内容
我在 .NET Core 3.1 系统中使用 Azure Functions V3
保罗
可能是因为nugget的版本与生成库的版本不匹配。您可以尝试以下方法:
1.From 包管理控制台做:
Get-Project –All | Add-BindingRedirect
在配置文件中重新生成 assemblyBinding
配置
2.If没解决,再手动添加绑定重定向。
根据您需要指定的版本进行修改
<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:指定要使用的程序集版本
我有一个 Azure 函数失败,并出现找不到
的程序集错误System.ComponentModel.Annotations, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
我的 Azure 函数和具有代码
的 class 库中都正确引用了此包我在两个项目文件中都有这个
<PropertyGroup>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<GenerateBindingRedirectsOutputType>true</GenerateBindingRedirectsOutputType>
</PropertyGroup>
我该如何解决这个非常令人沮丧的问题?
我引用了System.ComponentModel.Annotations包
似乎没有太多关于如何在 Azure 函数中进行程序集重定向的内容
我在 .NET Core 3.1 系统中使用 Azure Functions V3
保罗
可能是因为nugget的版本与生成库的版本不匹配。您可以尝试以下方法:
1.From 包管理控制台做:
Get-Project –All | Add-BindingRedirect
在配置文件中重新生成 assemblyBinding
配置
2.If没解决,再手动添加绑定重定向。 根据您需要指定的版本进行修改
<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:指定要使用的程序集版本