[英]Adding Reference to Class LIbrary in Azure Function project causes assembly not found
I dont really have much to go on here, but I have an Azure Function project (.NET Core 3.1 with Azure Functions v3)我真的没有太多事情要做,但我有一个 Azure Function 项目(.NET Core 3.1 with Azure Functions v3)
This function has a Http Trigger which works perfectly on its own这个函数有一个 Http 触发器,它自己完美地工作
However, as soon as I reference one of my existing projects, I get the error但是,一旦我引用了我现有的项目之一,就会收到错误消息
System.Private.CoreLib: Exception while executing function: MyFunction.
FunctionApp2: Could not load file or assembly 'Microsoft.Extensions.Primitives,
Version=5.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'.
Is this related to assembly binding?这与程序集绑定有关吗? How can I force this version to be available to my function application?
如何强制此版本可用于我的函数应用程序?
I dont have a web.config so the standard assembly binding wont work我没有 web.config 所以标准程序集绑定不起作用
Below is the file下面是文件
I have tried adding the assembly directly to the project and that makes no difference我曾尝试将程序集直接添加到项目中,但没有任何区别
The project I am referencing doesnt have this package either so I am not sure which package this comes from我引用的项目也没有这个包,所以我不确定它来自哪个包
My function app has the following packages我的函数应用有以下包
<ItemGroup>
<PackageReference Include="Fody" Version="6.5.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="LoadAssembliesOnStartup.Fody" Version="4.5.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.Azure.WebJobs.Extensions.ServiceBus" Version="4.3.0" />
<PackageReference Include="Microsoft.NET.Sdk.Functions" Version="3.0.13" />
</ItemGroup>
I tried to use Fody to ensure that the referenced project assembly is loaded on startup but that made no difference我尝试使用 Fody 来确保在启动时加载引用的项目程序集,但这没有任何区别
As soon as I remove my other project it works fine一旦我删除了我的其他项目,它就可以正常工作
Paul保罗
I found the problem eventually, there is an issue with Redis and Azure Functions我最终找到了问题,Redis 和 Azure Functions 存在问题
I had to downgrade Redis and it worked我不得不降级Redis并且它起作用了
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.